diff options
| -rw-r--r-- | src/main.zig | 8 | ||||
| -rw-r--r-- | test/cli.zig | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig index fa523fdb90..8162bc46b6 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2631,8 +2631,8 @@ fn fmtPathFile( if (check_mode) { const anything_changed = try std.zig.render(fmt.gpa, io.null_out_stream, tree); if (anything_changed) { - // TODO this should output to stdout instead of stderr. - std.debug.print("{}\n", .{file_path}); + const stdout = io.getStdOut().writer(); + try stdout.print("{}\n", .{file_path}); fmt.any_error = true; } } else { @@ -2649,8 +2649,8 @@ fn fmtPathFile( try af.file.writeAll(fmt.out_buffer.items); try af.finish(); - // TODO this should output to stdout instead of stderr. - std.debug.print("{}\n", .{file_path}); + const stdout = io.getStdOut().writer(); + try stdout.print("{}\n", .{file_path}); } } 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); } |
