lib/tests: Add test for freeform option docs

gstqt5
Silvan Mosberger 2020-09-04 15:50:13 +02:00
parent ea5ba6e13d
commit f320dbae41
No known key found for this signature in database
GPG Key ID: E8F1E9EAD284E17D
1 changed files with 26 additions and 0 deletions

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" ] ];
};
}