diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2019-10-12 20:37:21 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-01-10 16:20:31 +0100 |
commit | ab10e874141503cee57a4e4e92d4e3c31be2a2a3 (patch) | |
tree | 5b2b219e64393ca740b83d73d436fa015be3f518 /lib/tests/modules | |
parent | b48717d1eb9d4d9d60f3460274e7d9a961a402df (diff) |
lib/tests: Add tests for attrsOf and lazyAttrsOf
Diffstat (limited to 'lib/tests/modules')
-rw-r--r-- | lib/tests/modules/attrsOf-conditional-check.nix | 7 | ||||
-rw-r--r-- | lib/tests/modules/attrsOf-lazy-check.nix | 7 | ||||
-rw-r--r-- | lib/tests/modules/declare-attrsOf.nix | 6 | ||||
-rw-r--r-- | lib/tests/modules/declare-lazyAttrsOf.nix | 6 |
4 files changed, 26 insertions, 0 deletions
diff --git a/lib/tests/modules/attrsOf-conditional-check.nix b/lib/tests/modules/attrsOf-conditional-check.nix new file mode 100644 index 000000000000..0f00ebca1559 --- /dev/null +++ b/lib/tests/modules/attrsOf-conditional-check.nix @@ -0,0 +1,7 @@ +{ lib, config, ... }: { + options.conditionalWorks = lib.mkOption { + default = ! config.value ? foo; + }; + + config.value.foo = lib.mkIf false "should not be defined"; +} diff --git a/lib/tests/modules/attrsOf-lazy-check.nix b/lib/tests/modules/attrsOf-lazy-check.nix new file mode 100644 index 000000000000..ec5b418b15aa --- /dev/null +++ b/lib/tests/modules/attrsOf-lazy-check.nix @@ -0,0 +1,7 @@ +{ lib, config, ... }: { + options.isLazy = lib.mkOption { + default = ! config.value ? foo; + }; + + config.value.bar = throw "is not lazy"; +} diff --git a/lib/tests/modules/declare-attrsOf.nix b/lib/tests/modules/declare-attrsOf.nix new file mode 100644 index 000000000000..b3999de7e5fb --- /dev/null +++ b/lib/tests/modules/declare-attrsOf.nix @@ -0,0 +1,6 @@ +{ lib, ... }: { + options.value = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = {}; + }; +} diff --git a/lib/tests/modules/declare-lazyAttrsOf.nix b/lib/tests/modules/declare-lazyAttrsOf.nix new file mode 100644 index 000000000000..1d9fec25f908 --- /dev/null +++ b/lib/tests/modules/declare-lazyAttrsOf.nix @@ -0,0 +1,6 @@ +{ lib, ... }: { + options.value = lib.mkOption { + type = lib.types.lazyAttrsOf (lib.types.str // { emptyValue.value = "empty"; }); + default = {}; + }; +} |