From 0e4c3934a02cda80a72a730593ece41c7fa8026a Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Wed, 14 Oct 2020 16:20:20 +0200 Subject: zig fmt: write modified files to stdout not stderr --- test/cli.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/cli.zig') diff --git a/test/cli.zig b/test/cli.zig index 7a0a7d6459..284a184dc6 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -160,18 +160,18 @@ fn testZigFmt(zig_exe: []const u8, dir_path: []const u8) !void { const run_result1 = try exec(dir_path, true, &[_][]const u8{ zig_exe, "fmt", fmt1_zig_path }); // stderr should be file path + \n - testing.expect(std.mem.startsWith(u8, run_result1.stderr, fmt1_zig_path)); - testing.expect(run_result1.stderr.len == fmt1_zig_path.len + 1 and run_result1.stderr[run_result1.stderr.len - 1] == '\n'); + testing.expect(std.mem.startsWith(u8, run_result1.stdout, fmt1_zig_path)); + testing.expect(run_result1.stdout.len == fmt1_zig_path.len + 1 and run_result1.stdout[run_result1.stdout.len - 1] == '\n'); const fmt2_zig_path = try fs.path.join(a, &[_][]const u8{ dir_path, "fmt2.zig" }); try fs.cwd().writeFile(fmt2_zig_path, unformatted_code); const run_result2 = try exec(dir_path, true, &[_][]const u8{ zig_exe, "fmt", dir_path }); // running it on the dir, only the new file should be changed - testing.expect(std.mem.startsWith(u8, run_result2.stderr, fmt2_zig_path)); - testing.expect(run_result2.stderr.len == fmt2_zig_path.len + 1 and run_result2.stderr[run_result2.stderr.len - 1] == '\n'); + testing.expect(std.mem.startsWith(u8, run_result2.stdout, fmt2_zig_path)); + testing.expect(run_result2.stdout.len == fmt2_zig_path.len + 1 and run_result2.stdout[run_result2.stdout.len - 1] == '\n'); const run_result3 = try exec(dir_path, true, &[_][]const u8{ zig_exe, "fmt", dir_path }); // both files have been formatted, nothing should change now - testing.expect(run_result3.stderr.len == 0); + testing.expect(run_result3.stdout.len == 0); } -- cgit v1.2.3