about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xlib/tests/modules.sh3
-rw-r--r--lib/tests/modules/functionTo/submodule-options.nix16
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index 1a11f4ccfc0d..c7b8bbbf8c79 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -290,7 +290,8 @@ checkConfigOutput '^"a b"$' config.result ./functionTo/merging-list.nix
 checkConfigError 'A definition for option .fun.\[function body\]. is not of type .string.. Definition values:\n\s*- In .*wrong-type.nix' config.result ./functionTo/wrong-type.nix
 checkConfigOutput '^"b a"$' config.result ./functionTo/list-order.nix
 checkConfigOutput '^"a c"$' config.result ./functionTo/merging-attrs.nix
-checkConfigOutput '^"fun.\[function body\].a fun.\[function body\].b"$' config.result ./functionTo/submodule-options.nix
+checkConfigOutput '^"a bee"$' config.result ./functionTo/submodule-options.nix
+checkConfigOutput '^"fun.\[function body\].a fun.\[function body\].b"$' config.optionsResult ./functionTo/submodule-options.nix
 
 # moduleType
 checkConfigOutput '^"a b"$' config.resultFoo ./declare-variants.nix ./define-variant.nix
diff --git a/lib/tests/modules/functionTo/submodule-options.nix b/lib/tests/modules/functionTo/submodule-options.nix
index 7bf708231504..b884892efd6a 100644
--- a/lib/tests/modules/functionTo/submodule-options.nix
+++ b/lib/tests/modules/functionTo/submodule-options.nix
@@ -10,7 +10,7 @@ in
       options = {
         fun = lib.mkOption {
           type = types.functionTo (types.submodule {
-            options.a = lib.mkOption { };
+            options.a = lib.mkOption { default = "a"; };
           });
         };
       };
@@ -21,7 +21,7 @@ in
       options = {
         fun = lib.mkOption {
           type = types.functionTo (types.submodule {
-            options.b = lib.mkOption { };
+            options.b = lib.mkOption { default = "b"; };
           });
         };
       };
@@ -32,6 +32,12 @@ in
     result = lib.mkOption
       {
         type = types.str;
+        default = lib.concatStringsSep " " (lib.attrValues (config.fun (throw "shouldn't use input param")));
+      };
+
+    optionsResult = lib.mkOption
+      {
+        type = types.str;
         default = lib.concatStringsSep " "
           (lib.concatLists
             (lib.mapAttrsToList
@@ -50,10 +56,6 @@ in
 
   config.fun = lib.mkMerge
     [
-      (input: { inherit (input) a; })
-      (input: { inherit (input) b; })
-      (input: {
-        b = lib.mkForce input.c;
-      })
+      (input: { b = "bee"; })
     ];
 }