lib.types.optionDeclaration: test error
This commit is contained in:
@@ -706,6 +706,7 @@ checkConfigError 'The option .group..*would be a parent of the following options
|
||||
|
||||
# types.optionDeclaration
|
||||
checkConfigOutput '^10$' config.anOption ./option.nix
|
||||
checkConfigError 'A definition for option .aBadOptionDef. is not of type .option declaration.' config.aBadOptionDef ./option.nix
|
||||
|
||||
# Test that types.optionType merges types correctly
|
||||
checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options = {
|
||||
theOption = lib.mkOption {
|
||||
type = lib.types.optionDeclaration;
|
||||
};
|
||||
anOption = config.theOption;
|
||||
aBadOptionDef = lib.mkOption {
|
||||
type = lib.types.optionDeclaration;
|
||||
description = ''
|
||||
This option is perfectly fine, but will have a bad definition.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = {
|
||||
theOption = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
};
|
||||
anOption = 10;
|
||||
aBadOptionDef = options.theOption; # Not a declaration
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user