Skip to content

Commit

Permalink
lib/tests: test filterAttrs
Browse files Browse the repository at this point in the history
  • Loading branch information
h7x4 committed Sep 30, 2024
1 parent 46e09ce commit cd68034
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/tests/misc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ let
evalModules
extends
filter
filterAttrs
fix
fold
foldAttrs
Expand Down Expand Up @@ -1102,6 +1103,25 @@ runTests {
};
};

testFilterAttrs = {
expr = filterAttrs (n: v: n != "a" && (v.hello or false) == true) {
a.hello = true;
b.hello = true;
c = {
hello = true;
world = false;
};
d.hello = false;
};
expected = {
b.hello = true;
c = {
hello = true;
world = false;
};
};
};

# code from example
testFoldlAttrs = {
expr = {
Expand Down

0 comments on commit cd68034

Please sign in to comment.