authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-30 01:31:08-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-09-30 01:31:08-04:00
log14d6d07af2ce37569bce8b148599e31664de5f12
tree83e2fb2a68b820cf1cbb030d6b6b2880ec383d9d
parent839bdfdc93b1d2a2a4ed6f7c9ca3155323242d82

fix the cli test expected string to support native path separators


2 files changed, 4 insertions(+), 2 deletions(-)

lib/std/testing.zig+1-1
......@@ -38,7 +38,7 @@ pub fn expectError(expected_error: anyerror, actual_error_union: anytype) void {
3838/// This function is intended to be used only in tests. When the two values are not
3939/// equal, prints diagnostics to stderr to show exactly how they are not equal,
4040/// then aborts.
41/// The types must match exactly.
41/// `actual` is casted to the type of `expected`.
4242pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) void {
4343 switch (@typeInfo(@TypeOf(actual))) {
4444 .NoReturn,
test/cli.zig+3-1
......@@ -145,7 +145,9 @@ fn testMissingOutputPath(zig_exe: []const u8, dir_path: []const u8) !void {
145145 const output_arg = try std.fmt.allocPrint(a, "-femit-bin={s}", .{output_path});
146146 const source_path = try fs.path.join(a, &[_][]const u8{ "src", "main.zig" });
147147 const result = try exec(dir_path, false, &[_][]const u8{ zig_exe, "build-exe", source_path, output_arg });
148 testing.expect(std.mem.eql(u8, result.stderr, "error: unable to open output directory 'does/not/exist': FileNotFound\n"));
148 const s = std.fs.path.sep_str;
149 const expected: []const u8 = "error: unable to open output directory 'does" ++ s ++ "not" ++ s ++ "exist': FileNotFound\n";
150 testing.expectEqualStrings(expected, result.stderr);
149151}
150152
151153fn testZigFmt(zig_exe: []const u8, dir_path: []const u8) !void {