From 3cd078a6aeeb2713a86fb1119863e8ec56c20854 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 23 Dec 2016 12:58:24 +0100 Subject: [PATCH] travis: use OutputJsonCoverage --- etc/cover2json.g | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/etc/cover2json.g b/etc/cover2json.g index 1e78dc7845..ca764c7f9a 100644 --- a/etc/cover2json.g +++ b/etc/cover2json.g @@ -3,50 +3,5 @@ if LoadPackage("profiling") <> true then FORCE_QUIT_GAP(1); fi; -# CoverToJson is only here temporarily until its functionality has been -# published as part of the profiling package. -if not IsBound(CoverToJson) then -CoverToJson := function(data, outfile) - local outstream, lineinfo, prev, file, lines; - - outfile := USER_HOME_EXPAND(outfile); - outstream := IO_File(outfile, "w"); - - if not(IsRecord(data)) then - data := ReadLineByLineProfile(data); - fi; - - lineinfo := function(lineno, stat) - if stat[1] > 0 then - if stat[2] > 0 then - return STRINGIFY("\"", lineno, "\": \"1\""); - else - return STRINGIFY("\"", lineno, "\": \"0\""); - fi; - fi; - return ""; - end; - - IO_Write(outstream, "{ \"coverage\": {\n"); - prev := false; - - for file in data.line_info do - if file[1] <> "stream" then - if prev then - IO_Write(outstream, ",\n"); - fi; - IO_Write(outstream, Concatenation("\"", file[1], "\": {\n" )); - lines := List([1..Length(file[2])], n -> lineinfo(n, file[2][n])); - lines := Filtered(lines, l -> Length(l) > 0); - IO_Write(outstream, JoinStringsWithSeparator(lines, ",\n")); - IO_Write(outstream, "}\n"); - prev := true; - fi; - od; - IO_Write(outstream, "} }"); - IO_Close(outstream); -end; -fi; - -CoverToJson("coverage", "coverage.json"); +OutputJsonCoverage("coverage", "coverage.json"); QUIT_GAP(0);