fix the cli test expected string to support native path separators
parent
839bdfdc93
commit
14d6d07af2
|
@ -38,7 +38,7 @@ pub fn expectError(expected_error: anyerror, actual_error_union: anytype) void {
|
|||
/// This function is intended to be used only in tests. When the two values are not
|
||||
/// equal, prints diagnostics to stderr to show exactly how they are not equal,
|
||||
/// then aborts.
|
||||
/// The types must match exactly.
|
||||
/// `actual` is casted to the type of `expected`.
|
||||
pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) void {
|
||||
switch (@typeInfo(@TypeOf(actual))) {
|
||||
.NoReturn,
|
||||
|
|
|
@ -145,7 +145,9 @@ fn testMissingOutputPath(zig_exe: []const u8, dir_path: []const u8) !void {
|
|||
const output_arg = try std.fmt.allocPrint(a, "-femit-bin={s}", .{output_path});
|
||||
const source_path = try fs.path.join(a, &[_][]const u8{ "src", "main.zig" });
|
||||
const result = try exec(dir_path, false, &[_][]const u8{ zig_exe, "build-exe", source_path, output_arg });
|
||||
testing.expect(std.mem.eql(u8, result.stderr, "error: unable to open output directory 'does/not/exist': FileNotFound\n"));
|
||||
const s = std.fs.path.sep_str;
|
||||
const expected: []const u8 = "error: unable to open output directory 'does" ++ s ++ "not" ++ s ++ "exist': FileNotFound\n";
|
||||
testing.expectEqualStrings(expected, result.stderr);
|
||||
}
|
||||
|
||||
fn testZigFmt(zig_exe: []const u8, dir_path: []const u8) !void {
|
||||
|
|
Loading…
Reference in New Issue