Browse Source

lib/tests: Add test for freeform option docs

wip-nanopi-m4v2
Silvan Mosberger 6 years ago
parent
commit
f320dbae41
No known key found for this signature in database GPG Key ID: E8F1E9EAD284E17D
1 changed files with 26 additions and 0 deletions
  1. +26
    -0
      lib/tests/misc.nix

+ 26
- 0
lib/tests/misc.nix View File

@@ -542,4 +542,30 @@ runTests {
name = "";
expected = "unknown";
};

testFreeformOptions = {
expr =
let
submodule = { lib, ... }: {
freeformType = lib.types.attrsOf (lib.types.submodule {
options.bar = lib.mkOption {};
});
options.bar = lib.mkOption {};
};

module = { lib, ... }: {
options.foo = lib.mkOption {
type = lib.types.submodule submodule;
};
};

options = (evalModules {
modules = [ module ];
}).options;

locs = filter (o: ! o.internal) (optionAttrSetToDocList options);
in map (o: o.loc) locs;
expected = [ [ "foo" ] [ "foo" "<name>" "bar" ] [ "foo" "bar" ] ];
};

}

Loading…
Cancel
Save