lib/tests: test filterAttrs

This commit is contained in:
h7x4 2024-09-30 18:05:50 +02:00
parent c7c30eb452
commit 83e1488c6d
No known key found for this signature in database
GPG Key ID: 9F2F7D8250F35146

View File

@ -47,6 +47,7 @@ let
evalModules
extends
filter
filterAttrs
fix
fold
foldAttrs
@ -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 = {