improve progress reporting

* use erase rest of line escape code.
 * use `stderr.supportsAnsiEscapeCodes` rather than `isTty`.
 * respect `--color off`
 * avoid unnecessary recursion
 * add `Progress.log`
 * disable the progress std lib test since it's noisy and uses
   `time.sleep()`.
 * enable/integrate progress printing with the default test runner
This commit is contained in:
Andrew Kelley
2019-10-17 21:46:41 -04:00
parent 299991019d
commit 2d5b2bf1c9
8 changed files with 92 additions and 55 deletions

View File

@@ -87,7 +87,7 @@ fn exec(cwd: []const u8, argv: []const []const u8) !ChildProcess.ExecResult {
fn testZigInitLib(zig_exe: []const u8, dir_path: []const u8) !void {
_ = try exec(dir_path, [_][]const u8{ zig_exe, "init-lib" });
const test_result = try exec(dir_path, [_][]const u8{ zig_exe, "build", "test" });
testing.expect(std.mem.endsWith(u8, test_result.stderr, "All tests passed.\n"));
testing.expect(std.mem.eql(u8, test_result.stderr, ""));
}
fn testZigInitExe(zig_exe: []const u8, dir_path: []const u8) !void {
@@ -136,6 +136,6 @@ fn testMissingOutputPath(zig_exe: []const u8, dir_path: []const u8) !void {
const output_path = try fs.path.join(a, [_][]const u8{ "does", "not", "exist" });
const source_path = try fs.path.join(a, [_][]const u8{ "src", "main.zig" });
_ = try exec(dir_path, [_][]const u8{
zig_exe, "build-exe", source_path, "--output-dir", output_path
zig_exe, "build-exe", source_path, "--output-dir", output_path,
});
}