about summary refs log tree commit diff
path: root/lib/tests/modules.sh
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2021-12-08 19:02:29 +0100
committerSilvan Mosberger <contact@infinisil.com>2022-03-01 19:31:00 +0100
commit5cbeddfde486ca5524baeaf3da6e8944075cf463 (patch)
treed529522033bcfdc0272fba08e8e3fe1897dbe4e0 /lib/tests/modules.sh
parent891e65b0fa1b7c75c42b5404934307f64828e428 (diff)
lib.types: Introduce `types.optionType`
This type correctly merges multiple option types together while also
annotating them with file information. In a future commit this will be
used for `_module.freeformType`
Diffstat (limited to 'lib/tests/modules.sh')
-rwxr-xr-xlib/tests/modules.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index a1c592cf4ef0e..d11f32e59964b 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -299,6 +299,13 @@ checkConfigOutput "10" config.processedToplevel ./raw.nix
 checkConfigError "The option .multiple. is defined multiple times" config.multiple ./raw.nix
 checkConfigOutput "bar" config.priorities ./raw.nix
 
+# Test that types.optionType merges types correctly
+checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
+checkConfigOutput '^"hello"$' config.theOption.str ./optionTypeMerging.nix
+
+# Test that types.optionType correctly annotates option locations
+checkConfigError 'The option .theOption.nested. in .other.nix. is already declared in .optionTypeFile.nix.' config.theOption.nested ./optionTypeFile.nix
+
 cat <<EOF
 ====== module tests ======
 $pass Pass