diff options
Diffstat (limited to 'nixpkgs/lib/tests/modules/test-mergeAttrDefinitionsWithPrio.nix')
-rw-r--r-- | nixpkgs/lib/tests/modules/test-mergeAttrDefinitionsWithPrio.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nixpkgs/lib/tests/modules/test-mergeAttrDefinitionsWithPrio.nix b/nixpkgs/lib/tests/modules/test-mergeAttrDefinitionsWithPrio.nix new file mode 100644 index 000000000000..3233f4151368 --- /dev/null +++ b/nixpkgs/lib/tests/modules/test-mergeAttrDefinitionsWithPrio.nix @@ -0,0 +1,21 @@ +{ lib, options, ... }: + +let + defs = lib.modules.mergeAttrDefinitionsWithPrio options._module.args; + assertLazy = pos: throw "${pos.file}:${toString pos.line}:${toString pos.column}: The test must not evaluate this the assertLazy thunk, but it did. Unexpected strictness leads to unexpected errors and performance problems."; +in + +{ + options.result = lib.mkOption { }; + config._module.args = { + default = lib.mkDefault (assertLazy __curPos); + regular = null; + force = lib.mkForce (assertLazy __curPos); + unused = assertLazy __curPos; + }; + config.result = + assert defs.default.highestPrio == (lib.mkDefault (assertLazy __curPos)).priority; + assert defs.regular.highestPrio == lib.modules.defaultOverridePriority; + assert defs.force.highestPrio == (lib.mkForce (assertLazy __curPos)).priority; + true; +} |