refactor(nix/runTestsuite): clean up runTestsuite

* goodAss wasn't used before. Simplify it to just return a boolean, so
  we can use it for partitionTests later.

* goodIt also returns unnecessary extra meta information which is not
  used. Cleaning that up makes the condition extremely small, so we can
  inline it into (what was) goodIts.

* goodIts is just called in one place, so we can inline it into res.

Change-Id: I70cf4fa3f61ce1467a2ee5319f841cdd42db6a66
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3548
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
sterni 2021-09-15 00:17:27 +02:00
parent bef796d1d9
commit 5dec982334

View file

@ -140,23 +140,13 @@ let
runTestsuite = defun [ string (list ItResult) drv ]
(name: itResults:
let
goodAss = ass: {
good = AssertResult.match ass {
yep = _: true;
nope = _: false;
};
x = ass;
goodAss = ass: AssertResult.match ass {
yep = _: true;
nope = _: false;
};
goodIt = it: {
inherit (it) it-desc;
asserts = partitionTests (ass:
AssertResult.match ass {
yep = _: true;
nope = _: false;
}) it.asserts;
};
goodIts = partitionTests (it: (goodIt it).asserts.err == []);
res = goodIts itResults;
res = partitionTests (it:
(partitionTests goodAss it.asserts).err == []
) itResults;
prettyRes = lib.generators.toPretty {} res;
in
if res.err == []