Merge pull request 'lib/introspection: Test skipping instrospection of oneOf' (#5432) from ke-oneof-test into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5432
This commit is contained in:
@@ -699,4 +699,44 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test_listOf_either =
|
||||||
|
let
|
||||||
|
evaluated = eval [
|
||||||
|
{
|
||||||
|
options.extraModules = lib.mkOption {
|
||||||
|
description = "List of modules that can be strings, paths, or attrsets";
|
||||||
|
default = [ ];
|
||||||
|
type = lib.types.listOf (
|
||||||
|
lib.types.oneOf [
|
||||||
|
lib.types.str
|
||||||
|
lib.types.path
|
||||||
|
(lib.types.attrsOf lib.types.anything)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
({
|
||||||
|
_file = "config.nix";
|
||||||
|
extraModules = [
|
||||||
|
"modules/common.nix"
|
||||||
|
./some/path.nix
|
||||||
|
{ config = { }; }
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
result = slib.getPrios { options = evaluated.options; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit evaluated;
|
||||||
|
# Test that either types in list items return empty objects
|
||||||
|
# This is a behavioral test and not necessarily the correct
|
||||||
|
# behavior. But this is better than crashing on people directly.
|
||||||
|
expr = result.extraModules.__list;
|
||||||
|
expected = [
|
||||||
|
{ }
|
||||||
|
{ }
|
||||||
|
{ }
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user