summary refs log tree commit diff
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-09-30 01:49:58 +0200
committerSilvan Mosberger <contact@infinisil.com>2021-05-03 22:15:33 +0200
commitce5e3113c353d29edd0601af5c5ba38371f275d6 (patch)
treef12a29b31759d5ea884ab887fa9712dcef100d47
parent68955fe612683f30ef6f8bced39e9db6fb6b9577 (diff)
downloadnixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.tar
nixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.tar.gz
nixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.tar.bz2
nixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.tar.lz
nixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.tar.xz
nixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.tar.zst
nixpkgs-ce5e3113c353d29edd0601af5c5ba38371f275d6.zip
lib/tests: Make sure the submodule type description can be evaluated
In 2d45a62899d47c109a0b8ce4ca9d33265b8a1a37, the submodule type
description was amended with the freeformType description. This causes
all the modules passed to the submodule to be evaluated once on their
own, without any extra definitions from the config section. This means
that the specified modules need to be valid on their own, without any
undeclared options.

This commit adds a test that evaluates a submodules option description,
which would trigger the above problem for one of the tests, if it were
not fixed by this commit as well.

This is done because the next commit makes option evaluation a bit more
strict, which would also trigger this test failure, even though it's not
related to the change at all.
-rwxr-xr-xlib/tests/modules.sh3
-rw-r--r--lib/tests/modules/declare-submoduleWith-modules.nix4
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index 2eddeec07b1..2e57c2f8e2a 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -175,6 +175,9 @@ checkConfigOutput "true" config.submodule.config ./declare-submoduleWith-noshort
 ## submoduleWith should merge all modules in one swoop
 checkConfigOutput "true" config.submodule.inner ./declare-submoduleWith-modules.nix
 checkConfigOutput "true" config.submodule.outer ./declare-submoduleWith-modules.nix
+# Should also be able to evaluate the type name (which evaluates freeformType,
+# which evaluates all the modules defined by the type)
+checkConfigOutput "submodule" options.submodule.type.description ./declare-submoduleWith-modules.nix
 
 ## Paths should be allowed as values and work as expected
 checkConfigOutput "true" config.submodule.enable ./declare-submoduleWith-path.nix
diff --git a/lib/tests/modules/declare-submoduleWith-modules.nix b/lib/tests/modules/declare-submoduleWith-modules.nix
index 4736ab41751..a8b82d17688 100644
--- a/lib/tests/modules/declare-submoduleWith-modules.nix
+++ b/lib/tests/modules/declare-submoduleWith-modules.nix
@@ -8,9 +8,6 @@
             default = false;
           };
         }
-        {
-          outer = true;
-        }
       ];
     };
     default = {};
@@ -25,6 +22,7 @@
     })
     {
       inner = true;
+      outer = true;
     }
   ];
 }