lib/tests: Add tests for attrsOf and lazyAttrsOf
This commit is contained in:
committed by
Silvan Mosberger
parent
b48717d1eb
commit
ab10e87414
7
lib/tests/modules/attrsOf-conditional-check.nix
Normal file
7
lib/tests/modules/attrsOf-conditional-check.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{ lib, config, ... }: {
|
||||
options.conditionalWorks = lib.mkOption {
|
||||
default = ! config.value ? foo;
|
||||
};
|
||||
|
||||
config.value.foo = lib.mkIf false "should not be defined";
|
||||
}
|
||||
7
lib/tests/modules/attrsOf-lazy-check.nix
Normal file
7
lib/tests/modules/attrsOf-lazy-check.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{ lib, config, ... }: {
|
||||
options.isLazy = lib.mkOption {
|
||||
default = ! config.value ? foo;
|
||||
};
|
||||
|
||||
config.value.bar = throw "is not lazy";
|
||||
}
|
||||
6
lib/tests/modules/declare-attrsOf.nix
Normal file
6
lib/tests/modules/declare-attrsOf.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ lib, ... }: {
|
||||
options.value = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
default = {};
|
||||
};
|
||||
}
|
||||
6
lib/tests/modules/declare-lazyAttrsOf.nix
Normal file
6
lib/tests/modules/declare-lazyAttrsOf.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ lib, ... }: {
|
||||
options.value = lib.mkOption {
|
||||
type = lib.types.lazyAttrsOf (lib.types.str // { emptyValue.value = "empty"; });
|
||||
default = {};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user