From 085e122e296b30de7ef83d10564115a5991bbb2a Mon Sep 17 00:00:00 2001 From: Daniele Cocca Date: Fri, 18 Mar 2022 09:07:47 +0000 Subject: [PATCH] bugs/3779: replace expectEqual*() with expect() --- test/behavior/bugs/3779.zig | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/behavior/bugs/3779.zig b/test/behavior/bugs/3779.zig index 51b1725dd9..7dd0914161 100644 --- a/test/behavior/bugs/3779.zig +++ b/test/behavior/bugs/3779.zig @@ -7,9 +7,9 @@ const ptr_tag_name: [*:0]const u8 = tag_name; test "@tagName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong - try std.testing.expectEqual(*const [13:0]u8, @TypeOf(tag_name)); - try std.testing.expectEqualStrings("TestEnumValue", tag_name); - try std.testing.expectEqualStrings("TestEnumValue", ptr_tag_name[0..tag_name.len]); + try std.testing.expect(*const [13:0]u8 == @TypeOf(tag_name)); + try std.testing.expect(std.mem.eql(u8, "TestEnumValue", tag_name)); + try std.testing.expect(std.mem.eql(u8, "TestEnumValue", ptr_tag_name[0..tag_name.len])); } const TestError = error{TestErrorCode}; @@ -18,9 +18,9 @@ const ptr_error_name: [*:0]const u8 = error_name; test "@errorName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong - try std.testing.expectEqual(*const [13:0]u8, @TypeOf(error_name)); - try std.testing.expectEqualStrings("TestErrorCode", error_name); - try std.testing.expectEqualStrings("TestErrorCode", ptr_error_name[0..error_name.len]); + try std.testing.expect(*const [13:0]u8 == @TypeOf(error_name)); + try std.testing.expect(std.mem.eql(u8, "TestErrorCode", error_name)); + try std.testing.expect(std.mem.eql(u8, "TestErrorCode", ptr_error_name[0..error_name.len])); } const TestType = struct {}; @@ -29,9 +29,9 @@ const ptr_type_name: [*:0]const u8 = type_name; test "@typeName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong - try std.testing.expectEqual(*const [type_name.len:0]u8, @TypeOf(type_name)); - try std.testing.expectEqualStrings("behavior.bugs.3779.TestType", type_name); - try std.testing.expectEqualStrings("behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len]); + try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name)); + try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", type_name)); + try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len])); } const actual_contents = @embedFile("3779_file_to_embed.txt"); @@ -39,10 +39,10 @@ const ptr_actual_contents: [*:0]const u8 = actual_contents; const expected_contents = "hello zig\n"; test "@embedFile() returns a string literal" { - try std.testing.expectEqual(*const [expected_contents.len:0]u8, @TypeOf(actual_contents)); + try std.testing.expect(*const [expected_contents.len:0]u8 == @TypeOf(actual_contents)); try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents)); - try std.testing.expectEqualStrings(expected_contents, actual_contents); - try std.testing.expectEqualStrings(expected_contents, ptr_actual_contents[0..actual_contents.len]); + try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents)); + try std.testing.expect(std.mem.eql(u8, expected_contents, ptr_actual_contents[0..actual_contents.len])); } fn testFnForSrc() std.builtin.SourceLocation { @@ -51,9 +51,9 @@ fn testFnForSrc() std.builtin.SourceLocation { test "@src() returns a struct containing 0-terminated string slices" { const src = testFnForSrc(); - try std.testing.expectEqual([:0]const u8, @TypeOf(src.file)); + try std.testing.expect([:0]const u8 == @TypeOf(src.file)); try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig")); - try std.testing.expectEqual([:0]const u8, @TypeOf(src.fn_name)); + try std.testing.expect([:0]const u8 == @TypeOf(src.fn_name)); try std.testing.expect(std.mem.endsWith(u8, src.fn_name, "testFnForSrc")); const ptr_src_file: [*:0]const u8 = src.file;