about summary refs log tree commit diff
path: root/lib/tests/modules
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2023-12-10 13:49:02 +0100
committerGitHub <noreply@github.com>2023-12-10 13:49:02 +0100
commitd56f942e438a2c6df80f9ac7696041174ddbf261 (patch)
tree68b08e1f68ed371d2549140439fe7352095bc30b /lib/tests/modules
parentd826a919f9210f10354909099829e04fb2c0bdef (diff)
parent83712164e6eafcfbc80e290c62cd8adc9cdd0168 (diff)
Merge pull request #272709 from hercules-ci/module-system-test-pr-131205
lib/modules: Test optionless module errors from #131205
Diffstat (limited to 'lib/tests/modules')
-rw-r--r--lib/tests/modules/error-mkOption-in-config.nix14
-rw-r--r--lib/tests/modules/error-mkOption-in-submodule-config.nix12
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/tests/modules/error-mkOption-in-config.nix b/lib/tests/modules/error-mkOption-in-config.nix
new file mode 100644
index 0000000000000..2d78cd8db8bac
--- /dev/null
+++ b/lib/tests/modules/error-mkOption-in-config.nix
@@ -0,0 +1,14 @@
+{ lib, ... }:
+let
+  inherit (lib) mkOption;
+in
+{
+  wrong1 = mkOption {
+  };
+  # This is not actually reported separately, so could be omitted from the test
+  # but it makes the example more realistic.
+  # Making it parse this _config_ as options would too risky. What if it's not
+  # options but other values, that abort, throw, diverge, etc?
+  nest.wrong2 = mkOption {
+  };
+}
diff --git a/lib/tests/modules/error-mkOption-in-submodule-config.nix b/lib/tests/modules/error-mkOption-in-submodule-config.nix
new file mode 100644
index 0000000000000..91ac3d65780a5
--- /dev/null
+++ b/lib/tests/modules/error-mkOption-in-submodule-config.nix
@@ -0,0 +1,12 @@
+{ lib, ... }:
+let
+  inherit (lib) mkOption;
+in
+{
+  options.sub = lib.mkOption {
+    type = lib.types.submodule {
+      wrong2 = mkOption {};
+    };
+    default = {};
+  };
+}