mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
lib/tests: Add test for freeform option docs
This commit is contained in:
parent
ea5ba6e13d
commit
f320dbae41
@ -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…
Reference in New Issue
Block a user