From ab10e874141503cee57a4e4e92d4e3c31be2a2a3 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sat, 12 Oct 2019 20:37:21 +0200 Subject: lib/tests: Add tests for attrsOf and lazyAttrsOf --- lib/tests/modules.sh | 9 +++++++++ lib/tests/modules/attrsOf-conditional-check.nix | 7 +++++++ lib/tests/modules/attrsOf-lazy-check.nix | 7 +++++++ lib/tests/modules/declare-attrsOf.nix | 6 ++++++ lib/tests/modules/declare-lazyAttrsOf.nix | 6 ++++++ 5 files changed, 35 insertions(+) create mode 100644 lib/tests/modules/attrsOf-conditional-check.nix create mode 100644 lib/tests/modules/attrsOf-lazy-check.nix create mode 100644 lib/tests/modules/declare-attrsOf.nix create mode 100644 lib/tests/modules/declare-lazyAttrsOf.nix (limited to 'lib/tests') diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 79d90670fb53..c8340ff7f157 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -186,6 +186,15 @@ checkConfigError 'The option .* defined in .* does not exist' config.enable ./di # Check that imports can depend on derivations checkConfigOutput "true" config.enable ./import-from-store.nix +# Check attrsOf and lazyAttrsOf. Only lazyAttrsOf should be lazy, and only +# attrsOf should work with conditional definitions +# In addition, lazyAttrsOf should honor an options emptyValue +checkConfigError "is not lazy" config.isLazy ./declare-attrsOf.nix ./attrsOf-lazy-check.nix +checkConfigOutput "true" config.isLazy ./declare-lazyAttrsOf.nix ./attrsOf-lazy-check.nix +checkConfigOutput "true" config.conditionalWorks ./declare-attrsOf.nix ./attrsOf-conditional-check.nix +checkConfigOutput "false" config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix +checkConfigOutput "empty" config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix + cat <