lib/tests: Add submodule file propagation test
This commit is contained in:
parent
492faa4f42
commit
79441600c2
2 changed files with 25 additions and 0 deletions
|
@ -194,6 +194,10 @@ checkConfigOutput '^"submodule"$' options.submodule.type.description ./declare-s
|
|||
## Paths should be allowed as values and work as expected
|
||||
checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path.nix
|
||||
|
||||
# Check the file location information is propagated into submodules
|
||||
checkConfigOutput the-file.nix config.submodule.internalFiles.0 ./submoduleFiles.nix
|
||||
|
||||
|
||||
# Check that disabledModules works recursively and correctly
|
||||
checkConfigOutput '^true$' config.enable ./disable-recursive/main.nix
|
||||
checkConfigOutput '^true$' config.enable ./disable-recursive/{main.nix,disable-foo.nix}
|
||||
|
|
21
lib/tests/modules/submoduleFiles.nix
Normal file
21
lib/tests/modules/submoduleFiles.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ lib, ... }: {
|
||||
options.submodule = lib.mkOption {
|
||||
default = {};
|
||||
type = lib.types.submoduleWith {
|
||||
modules = [ ({ options, ... }: {
|
||||
options.value = lib.mkOption {};
|
||||
|
||||
options.internalFiles = lib.mkOption {
|
||||
default = options.value.files;
|
||||
};
|
||||
})];
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
{
|
||||
_file = "the-file.nix";
|
||||
submodule.value = 10;
|
||||
}
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue