| ... | ... | @@ -160,18 +160,18 @@ fn testZigFmt(zig_exe: []const u8, dir_path: []const u8) !void { |
| 160 | 160 | |
| 161 | 161 | const run_result1 = try exec(dir_path, true, &[_][]const u8{ zig_exe, "fmt", fmt1_zig_path }); |
| 162 | 162 | // stderr should be file path + \n |
| 163 | | testing.expect(std.mem.startsWith(u8, run_result1.stderr, fmt1_zig_path)); |
| 164 | | testing.expect(run_result1.stderr.len == fmt1_zig_path.len + 1 and run_result1.stderr[run_result1.stderr.len - 1] == '\n'); |
| 163 | testing.expect(std.mem.startsWith(u8, run_result1.stdout, fmt1_zig_path)); |
| 164 | testing.expect(run_result1.stdout.len == fmt1_zig_path.len + 1 and run_result1.stdout[run_result1.stdout.len - 1] == '\n'); |
| 165 | 165 | |
| 166 | 166 | const fmt2_zig_path = try fs.path.join(a, &[_][]const u8{ dir_path, "fmt2.zig" }); |
| 167 | 167 | try fs.cwd().writeFile(fmt2_zig_path, unformatted_code); |
| 168 | 168 | |
| 169 | 169 | const run_result2 = try exec(dir_path, true, &[_][]const u8{ zig_exe, "fmt", dir_path }); |
| 170 | 170 | // running it on the dir, only the new file should be changed |
| 171 | | testing.expect(std.mem.startsWith(u8, run_result2.stderr, fmt2_zig_path)); |
| 172 | | testing.expect(run_result2.stderr.len == fmt2_zig_path.len + 1 and run_result2.stderr[run_result2.stderr.len - 1] == '\n'); |
| 171 | testing.expect(std.mem.startsWith(u8, run_result2.stdout, fmt2_zig_path)); |
| 172 | testing.expect(run_result2.stdout.len == fmt2_zig_path.len + 1 and run_result2.stdout[run_result2.stdout.len - 1] == '\n'); |
| 173 | 173 | |
| 174 | 174 | const run_result3 = try exec(dir_path, true, &[_][]const u8{ zig_exe, "fmt", dir_path }); |
| 175 | 175 | // both files have been formatted, nothing should change now |
| 176 | | testing.expect(run_result3.stderr.len == 0); |
| 176 | testing.expect(run_result3.stdout.len == 0); |
| 177 | 177 | } |