Unverified Commit 83e1488c authored by h7x4's avatar h7x4
Browse files

lib/tests: test `filterAttrs`

parent c7c30eb4
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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 = {