diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-11-27 14:44:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-27 14:44:37 +0100 |
commit | 51357572f2bf7df8241df858a40e6b9a0a159704 (patch) | |
tree | a773610a1ba450a7262fad5a6bb19aa1cb1a199c /lib/tests | |
parent | 6cb4361581014bcf867fc9f917628ce09ce7f069 (diff) | |
parent | 013a0a1357c446d0a46b4bbd8f68512fd9223257 (diff) |
Merge pull request #269552 from adisbladis/lib-matchattrs-list-allocs
lib.attrsets.matchAttrs: Avoid some list allocations when walking structure
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/misc.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 8f4a37149d92c..9f1fee2ba2341 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -831,6 +831,26 @@ runTests { }; }; + testMatchAttrsMatchingExact = { + expr = matchAttrs { cpu = { bits = 64; }; } { cpu = { bits = 64; }; }; + expected = true; + }; + + testMatchAttrsMismatch = { + expr = matchAttrs { cpu = { bits = 128; }; } { cpu = { bits = 64; }; }; + expected = false; + }; + + testMatchAttrsMatchingImplicit = { + expr = matchAttrs { cpu = { }; } { cpu = { bits = 64; }; }; + expected = true; + }; + + testMatchAttrsMissingAttrs = { + expr = matchAttrs { cpu = {}; } { }; + expected = false; + }; + testOverrideExistingEmpty = { expr = overrideExisting {} { a = 1; }; expected = {}; |