From 15c873b486347e7861c64fb0b5a7852be9fc82e4 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 16 Mar 2020 21:08:39 +0100 Subject: lib/modules: Throw better error when definitions assign to an option set --- lib/tests/modules.sh | 4 ++++ lib/tests/modules/declare-option-set.nix | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 lib/tests/modules/declare-option-set.nix (limited to 'lib/tests') diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 8cd632a439cd..0e2fd0bf65d2 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -194,6 +194,10 @@ 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 + cat < Date: Mon, 16 Mar 2020 21:10:05 +0100 Subject: lib/modules: Fix type checks not being done before merging Co-Authored-By: Robert Hensing --- lib/tests/modules.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/tests') diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 0e2fd0bf65d2..7713207dadda 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -198,6 +198,10 @@ checkConfigOutput "empty" config.value.foo ./declare-lazyAttrsOf.nix ./attrsOf-c 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 <