anchor.diff:        then [ { inherit name; expected = test.expected; result = test.expr; } ]
         else [] ) tests));
   
  -  # create a test assuming that list elements are true
  -  # usage: { testX = allTrue [ true ]; }
  +  /* Create a test assuming that list elements are `true`.
  +
  +     Example:
  +       { testX = allTrue [ true ]; }
  +  */
     testAllTrue = expr: { inherit expr; expected = map (x: true) expr; };
   
   
  
positive.code: 
    # -- TRACING --
  
    /* Trace msg, but only if pred is true.
  
       Example:
         traceIf true "hello" 3
         trace: hello
         => 3
    */
    traceIf = pred: msg: x: if pred then trace msg x else x;
  
    /* Trace the value and also return it.
  
       Example:
         traceValFn (v: "mystring ${v}") "foo"
         trace: mystring foo
         => "foo"
    */
    traceValFn = f: x: trace (f x) x;
    traceVal = traceValFn id;
  
    /* `builtins.trace`, but the value is `builtins.deepSeq`ed first.
  
       Example:
         trace { a.b.c = 3; } null
  
negative.code:     in trace (generators.toPretty { allowPrettyValues = true; }
                 (modify depth snip x)) y;
  
    /* A combination of `traceVal` and `traceSeq` that applies a
       provided function to the value to be traced after `deepSeq`ing
       it.
    */
    traceValSeqFn =
      # Function to apply
      f:
      # Value to trace
      v: traceValFn f (builtins.deepSeq v v);
  
    /* A combination of `traceVal` and `traceSeq`. */
    traceValSeq = traceValSeqFn id;
  
    /* A combination of `traceVal` and `traceSeqN` that applies a
    provided function to the value to be traced. */
    traceValSeqNFn =
      # Function to apply
      f:
      depth:
      # Value to trace
      v: traceSeqN depth (f v) v;
  
    /* A combination of `traceVal` and `traceSeqN`. */
    traceValSeqN = traceValSeqNFn id;
  
  
    # -- TESTING --
  
    /* Evaluate a set of tests.  A test is an attribute set `{expr,
       expected}`, denoting an expression and its expected result.  The
       result is a list of failed tests, each represented as `{name,
       expected, actual}`, denoting the attribute name of the failing
       test and its expected and actual results.
  
       Used for regression testing of the functions in lib; see
       tests.nix for an example. Only tests having names starting with
       "test" are run.
  
       Add attr { tests = ["testName"]; } to run these tests only.
    */
    runTests =
      # Tests to run
      tests: lib.concatLists (lib.attrValues (lib.mapAttrs (name: test:
      let testsToRun = if tests ? tests then tests.tests else [];
      in if (substring 0 4 name == "test" ||  elem name testsToRun)
         && ((testsToRun == []) || elem name tests.tests)
  