3 equal = expected: actual:
4 if actual == expected then
5 (test.passed "= ${toString expected}") else
7 "expected '${toString expected}'(${builtins.typeOf expected})"
9 "actual '${toString actual}'(${builtins.typeOf actual})"
13 if builtins.isAttrs actual then
14 (test.passed "is a set") else
15 (test.failed "is not a set, was ${builtins.typeOf actual}: ${toString actual}");
17 haveKeys = expected: actual:
19 (ex: builtins.any (ac: ex == ac) (builtins.attrNames actual))
21 (test.passed "has expected keys") else
22 (test.failed "keys differ: expected: [${lib.concatStringsSep ";" expected}] actual: [${lib.concatStringsSep ";" (builtins.attrNames actual)}]");
24 havePrefix = expected: actual:
25 if lib.hasPrefix expected actual then
26 (test.passed "has prefix '${expected}'") else
27 (test.failed "prefix '${expected}' not found in '${actual}'");