mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-11-27 00:10:12 +00:00
lib/tests/modules: make sure options stay lazy in unmatched definitions
This commit is contained in:
@@ -173,6 +173,7 @@ checkConfigOutput '^"one two"$' config.result ./shorthand-meta.nix
|
||||
|
||||
checkConfigError "In module .*test-push-down-non-attrs.nix., you're trying to define a value of type \`bool'\n\s*rather than an attribute set for the option" config ./test-push-down-non-attrs.nix
|
||||
checkConfigError "In module .*test-push-down-non-attrs-nested.nix., you're trying to define a value of type \`bool'\n\s*rather than an attribute set for the option\n\s*\`a\.b'!" config.a.b.c ./test-push-down-non-attrs-nested.nix
|
||||
checkConfigOutput '^1$' config.a.b.x ./options-lazy-in-unmatched-defns.nix
|
||||
|
||||
checkConfigOutput '^true$' config.result ./test-mergeAttrDefinitionsWithPrio.nix
|
||||
checkConfigOutput '^true$' config.result ./test-fixupOptionType-idempotent.nix
|
||||
|
||||
12
lib/tests/modules/options-lazy-in-unmatched-defns.nix
Normal file
12
lib/tests/modules/options-lazy-in-unmatched-defns.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{ lib, options, ... }:
|
||||
|
||||
{
|
||||
options.a.b = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = { };
|
||||
};
|
||||
|
||||
# Reading a nested option's declarations must not require the definitions
|
||||
# under its parent, e.g. to check them for unmatched definitions.
|
||||
config.a = if options.a.b.declarations != [ ] then { b.x = 1; } else { };
|
||||
}
|
||||
Reference in New Issue
Block a user