aboutsummaryrefslogtreecommitdiff
path: root/test/cli.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-10-14 16:20:20 +0200
committerAndrew Kelley <andrew@ziglang.org>2020-10-16 20:23:18 -0400
commit0e4c3934a02cda80a72a730593ece41c7fa8026a (patch)
tree923d6b37f0000bb47e2b0f004d8d38798172c4f3 /test/cli.zig
parent8364417c8fead9f617a4c1a83af0c6401a1c4240 (diff)
downloadzig-0e4c3934a02cda80a72a730593ece41c7fa8026a.tar.gz
zig-0e4c3934a02cda80a72a730593ece41c7fa8026a.zip
zig fmt: write modified files to stdout not stderr
Diffstat (limited to 'test/cli.zig')
-rw-r--r--test/cli.zig10
1 files changed, 5 insertions, 5 deletions
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);
}