From 5dec98233482ebd651f9be77984a178d6656efe4 Mon Sep 17 00:00:00 2001 From: sterni Date: Wed, 15 Sep 2021 00:17:27 +0200 Subject: [PATCH] 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 --- nix/runTestsuite/default.nix | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/nix/runTestsuite/default.nix b/nix/runTestsuite/default.nix index dc8e40f8a..f9a156047 100644 --- a/nix/runTestsuite/default.nix +++ b/nix/runTestsuite/default.nix @@ -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 == []