summary refs log tree commit diff
path: root/pkgs/development/ruby-modules/bundler-env/tap-support.nix
blob: ba576683d3727e4f234562103888c1207a9d5904 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
with builtins;
let
  withIndexes = list: genList (idx: (elemAt list idx) // {index = idx;}) (length list);

  testLine = report: "${okStr report} ${toString report.index} ${report.description}" + testDirective report + testYaml report;

  testDirective = report: "";

  testYaml = report: "";

  okStr = { result, ...}: if result == "pass" then "ok" else "not ok";
in
  {
    output = reports: ''
      TAP version 13
      1..${toString (length reports)}'' + (foldl' (l: r: l + "\n" + r) "" (map testLine (withIndexes reports))) + ''

      # Finished at ${toString currentTime}
      '';
  }