about summary refs log tree commit diff
path: root/lib/tests/modules
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-07-08 22:18:36 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-08-14 10:44:56 +0200
commit0d472a62012364d064f0b75f1da491242c6ae9c6 (patch)
tree368ea6304232e38b80a6892495dffedb39e75e56 /lib/tests/modules
parent450d6437aeda4c90bb948f6f1f7d25a005ab9bb2 (diff)
downloadnixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.tar
nixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.tar.gz
nixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.tar.bz2
nixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.tar.lz
nixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.tar.xz
nixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.tar.zst
nixlib-0d472a62012364d064f0b75f1da491242c6ae9c6.zip
lib/modules: Report a good error when option tree has bare type
Note that this removes the possibility of declaring an option
named `_type`.
Diffstat (limited to 'lib/tests/modules')
-rw-r--r--lib/tests/modules/options-type-error-configuration.nix6
-rw-r--r--lib/tests/modules/options-type-error-typical-nested.nix5
-rw-r--r--lib/tests/modules/options-type-error-typical.nix5
3 files changed, 16 insertions, 0 deletions
diff --git a/lib/tests/modules/options-type-error-configuration.nix b/lib/tests/modules/options-type-error-configuration.nix
new file mode 100644
index 000000000000..bcd6db89487a
--- /dev/null
+++ b/lib/tests/modules/options-type-error-configuration.nix
@@ -0,0 +1,6 @@
+{ lib, ... }: {
+  options = {
+    # unlikely mistake, but we can catch any attrset with _type
+    result = lib.evalModules { modules = []; };
+  };
+}
diff --git a/lib/tests/modules/options-type-error-typical-nested.nix b/lib/tests/modules/options-type-error-typical-nested.nix
new file mode 100644
index 000000000000..2c07e19fb8ae
--- /dev/null
+++ b/lib/tests/modules/options-type-error-typical-nested.nix
@@ -0,0 +1,5 @@
+{ lib, ... }: {
+  options = {
+    result.here = lib.types.str;
+  };
+}
diff --git a/lib/tests/modules/options-type-error-typical.nix b/lib/tests/modules/options-type-error-typical.nix
new file mode 100644
index 000000000000..416f436e0ad7
--- /dev/null
+++ b/lib/tests/modules/options-type-error-typical.nix
@@ -0,0 +1,5 @@
+{ lib, ... }: {
+  options = {
+    result = lib.types.str;
+  };
+}