lib/tests: remove strictly loaOf tests and rebase on attrsOf

This commit is contained in:
rnhmjoj
2019-06-13 23:53:03 +02:00
committed by worldofpeace
parent 1d61efb7f1
commit cde46494c6
23 changed files with 59 additions and 103 deletions

View File

@@ -17,10 +17,10 @@ in
{
options = {
loaOfSub = lib.mkOption {
attrsOfSub = lib.mkOption {
default = {};
example = {};
type = lib.types.loaOf (lib.types.submodule [ submod ]);
type = lib.types.attrsOf (lib.types.submodule [ submod ]);
description = ''
Some descriptive text
'';

View File

@@ -0,0 +1,3 @@
{
attrsOfSub.bar.enable = true;
}

View File

@@ -0,0 +1,3 @@
{
attrsOfSub.bar = {};
}

View File

@@ -0,0 +1,5 @@
{ lib, ... }:
{
attrsOfSub.foo.enable = lib.mkForce false;
}

View File

@@ -0,0 +1,5 @@
{ config, lib, ... }:
{
attrsOfSub.foo.enable = lib.mkIf config.enable true;
}

View File

@@ -0,0 +1,3 @@
{
attrsOfSub.foo.enable = true;
}

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{
loaOfSub.foo = lib.mkForce {
attrsOfSub.foo = lib.mkForce {
enable = false;
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{
loaOfSub.foo = lib.mkIf config.enable {
attrsOfSub.foo = lib.mkIf config.enable {
enable = true;
};
}

View File

@@ -0,0 +1,3 @@
{
attrsOfSub.foo = {};
}

View File

@@ -1,7 +1,7 @@
{ lib, ... }:
{
loaOfSub = lib.mkForce {
attrsOfSub = lib.mkForce {
foo.enable = false;
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, ... }:
{
loaOfSub = lib.mkIf config.enable {
attrsOfSub = lib.mkIf config.enable {
foo.enable = true;
};
}

View File

@@ -0,0 +1,5 @@
{ lib, ... }:
lib.mkForce {
attrsOfSub.foo.enable = false;
}

View File

@@ -1,5 +0,0 @@
{ lib, ... }:
lib.mkForce {
loaOfSub.foo.enable = false;
}

View File

@@ -1,5 +1,5 @@
{ config, lib, ... }:
lib.mkIf config.enable {
loaOfSub.foo.enable = true;
attrsOfSub.foo.enable = true;
}

View File

@@ -1,3 +0,0 @@
{
loaOfSub.bar.enable = true;
}

View File

@@ -1,3 +0,0 @@
{
loaOfSub.bar = {};
}

View File

@@ -1,5 +0,0 @@
{ lib, ... }:
{
loaOfSub.foo.enable = lib.mkForce false;
}

View File

@@ -1,5 +0,0 @@
{ config, lib, ... }:
{
loaOfSub.foo.enable = lib.mkIf config.enable true;
}

View File

@@ -1,3 +0,0 @@
{
loaOfSub.foo.enable = true;
}

View File

@@ -1,3 +0,0 @@
{
loaOfSub.foo = {};
}

View File

@@ -1,19 +0,0 @@
{ config, lib, ... }:
{
options = {
loaOfInt = lib.mkOption {
type = lib.types.loaOf lib.types.int;
};
result = lib.mkOption {
type = lib.types.str;
};
};
config = {
loaOfInt = [ 1 2 3 4 5 6 7 8 9 10 ];
result = toString (lib.attrValues config.loaOfInt);
};
}

View File

@@ -1,19 +0,0 @@
{ config, lib, ... }:
{
options = {
loaOfInt = lib.mkOption {
type = lib.types.loaOf lib.types.int;
};
result = lib.mkOption {
type = lib.types.str;
};
};
config = {
loaOfInt = lib.mkMerge (map lib.singleton [ 1 2 3 4 5 6 7 8 9 10 ]);
result = toString (lib.attrValues config.loaOfInt);
};
}