about summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-02-28 22:39:56 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-03-03 00:29:11 +0100
commit11537c9c0239dc4ae52477faa78a4a0a7bdf206c (patch)
tree4c7d2b9f657108be2a4ddb0641643417df53952c /lib/tests
parent81f342d1f3a6bab4a57e195ce99a153b82b1ef86 (diff)
lib.modules: Improve option-is-prefix error message
Diffstat (limited to 'lib/tests')
-rwxr-xr-xlib/tests/modules.sh6
-rw-r--r--lib/tests/modules/declare-set.nix12
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index 3591b8f1e6fc6..e903714a72099 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -309,6 +309,12 @@ checkConfigOutput "10" config.processedToplevel ./raw.nix
 checkConfigError "The option .multiple. is defined multiple times" config.multiple ./raw.nix
 checkConfigOutput "bar" config.priorities ./raw.nix
 
+## Option collision
+checkConfigError \
+  'The option .set. in module .*/declare-set.nix. would be a parent of the following options, but its type .attribute set of signed integers. does not support nested options.\n\s*- option[(]s[)] with prefix .set.enable. in module .*/declare-enable-nested.nix.' \
+  config.set \
+  ./declare-set.nix ./declare-enable-nested.nix
+
 # Test that types.optionType merges types correctly
 checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
 checkConfigOutput '^"hello"$' config.theOption.str ./optionTypeMerging.nix
diff --git a/lib/tests/modules/declare-set.nix b/lib/tests/modules/declare-set.nix
new file mode 100644
index 0000000000000..853418531a812
--- /dev/null
+++ b/lib/tests/modules/declare-set.nix
@@ -0,0 +1,12 @@
+{ lib, ... }:
+
+{
+  options.set = lib.mkOption {
+    default = { };
+    example = { a = 1; };
+    type = lib.types.attrsOf lib.types.int;
+    description = ''
+      Some descriptive text
+    '';
+  };
+}