1with builtins;
2let
3 withIndexes = list: genList (idx: (elemAt list idx) // { index = idx; }) (length list);
4
5 testLine =
6 report:
7 "${okStr report} ${toString (report.index + 1)} ${report.description}"
8 + testDirective report
9 + testYaml report;
10
11 # These are part of the TAP spec, not yet implemented.
12 #c.f. https://github.com/NixOS/nixpkgs/issues/27071
13 testDirective = report: "";
14 testYaml = report: "";
15
16 okStr = { result, ... }: if result == "pass" then "ok" else "not ok";
17in
18{
19 output =
20 reports:
21 ''
22 TAP version 13
23 1..${toString (length reports)}''
24 + (foldl' (l: r: l + "\n" + r) "" (map testLine (withIndexes reports)))
25 + ''
26
27 # Finished at ${toString currentTime}
28 '';
29}