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