summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2021-12-07 19:38:43 +0100
committerGitHub <noreply@github.com>2021-12-07 19:38:43 +0100
commitae0b7d6db0caf08bfb8679de909f4837b1d49cbf (patch)
treead9342d864287a3c8f0626c55d38c50ecd98dfed /lib/tests
parentfd6a2f3279ca65fc6d8079bf2167796e87cbdf5c (diff)
parent844a9e746f92ac7278ece51c2b7819d0e6c5c05d (diff)
Merge pull request #144022 from hercules-ci/lib-modules-optimize-unmatchedDefns
lib/modules: Short-circuit unmatchedDefns when configs is empty
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/modules/declare-attrsOf.nix9
-rw-r--r--lib/tests/modules/freeform-nested.nix9
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/tests/modules/declare-attrsOf.nix b/lib/tests/modules/declare-attrsOf.nix
index b3999de7e5fb..d19964064b21 100644
--- a/lib/tests/modules/declare-attrsOf.nix
+++ b/lib/tests/modules/declare-attrsOf.nix
@@ -1,6 +1,13 @@
-{ lib, ... }: {
+{ lib, ... }:
+let
+ deathtrapArgs = lib.mapAttrs
+ (k: _: throw "The module system is too strict, accessing an unused option's ${k} mkOption-attribute.")
+ (lib.functionArgs lib.mkOption);
+in
+{
options.value = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = {};
};
+ options.testing-laziness-so-don't-read-me = lib.mkOption deathtrapArgs;
}
diff --git a/lib/tests/modules/freeform-nested.nix b/lib/tests/modules/freeform-nested.nix
index 5da27f5a8b4f..b81fa7f0d222 100644
--- a/lib/tests/modules/freeform-nested.nix
+++ b/lib/tests/modules/freeform-nested.nix
@@ -1,7 +1,14 @@
-{ lib, ... }: {
+{ lib, ... }:
+let
+ deathtrapArgs = lib.mapAttrs
+ (k: _: throw "The module system is too strict, accessing an unused option's ${k} mkOption-attribute.")
+ (lib.functionArgs lib.mkOption);
+in
+{
options.nest.foo = lib.mkOption {
type = lib.types.bool;
default = false;
};
+ options.nest.unused = lib.mkOption deathtrapArgs;
config.nest.bar = "bar";
}