summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2020-03-18 10:06:06 +0100
committerGitHub <noreply@github.com>2020-03-18 10:06:06 +0100
commit5f357b20b3b05aad591701c374ade77f470e4d89 (patch)
tree5785ecc4f2381b3085bd011881ae21d315c67167 /lib/tests
parent071d0cc0cb0d8a6bc54f6eca79c786109a5302ce (diff)
parente931de58a2f724c3632b7c8a656fb47489ecc963 (diff)
Merge pull request #82751 from Infinisil/minor-module-improvements
Minor module improvements
Diffstat (limited to 'lib/tests')
-rwxr-xr-xlib/tests/modules.sh8
-rw-r--r--lib/tests/modules/declare-option-set.nix3
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index d87f9db0a900..1b3d01646d84 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -199,6 +199,14 @@ checkConfigOutput "true" config.conditionalWorks ./declare-attrsOf.nix ./attrsOf
checkConfigOutput "false" config.conditionalWorks ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
checkConfigOutput "empty" config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-conditional-check.nix
+# Check error for when an option set is defined to be a non-attribute set value
+checkConfigError 'The option path .* is an attribute set of options, but it is defined to not be an attribute set in' \
+ config.value ./declare-option-set.nix ./define-value-int-zero.nix
+
+# Even with multiple assignments, a type error should be thrown if any of them aren't valid
+checkConfigError 'The option value .* in .* is not of type .*' \
+ config.value ./declare-int-unsigned-value.nix ./define-value-list.nix ./define-value-int-positive.nix
+
cat <<EOF
====== module tests ======
$pass Pass
diff --git a/lib/tests/modules/declare-option-set.nix b/lib/tests/modules/declare-option-set.nix
new file mode 100644
index 000000000000..fddc650ffa90
--- /dev/null
+++ b/lib/tests/modules/declare-option-set.nix
@@ -0,0 +1,3 @@
+{
+ options.value = {};
+}