authorgravatar for daniele.cocca@gmail.comDaniele Cocca <daniele.cocca@gmail.com> 2022-03-18 09:07:47+00:00
committergravatar for daniele.cocca@gmail.comDaniele Cocca <daniele.cocca@gmail.com> 2022-03-18 11:20:28+00:00
log085e122e296b30de7ef83d10564115a5991bbb2a
treeb14ecb0ce8aa0eb9244fb7ade98b337658e36af5
parentaf8586da3a2f50c55c0c8e04152230cf71aa12d0

bugs/3779: replace expectEqual*() with expect()


1 files changed, 14 insertions(+), 14 deletions(-)

test/behavior/bugs/3779.zig+14-14
...@@ -7,9 +7,9 @@ const ptr_tag_name: [*:0]const u8 = tag_name;...@@ -7,9 +7,9 @@ const ptr_tag_name: [*:0]const u8 = tag_name;
77
8test "@tagName() returns a string literal" {8test "@tagName() returns a string literal" {
9 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong9 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
10 try std.testing.expectEqual(*const [13:0]u8, @TypeOf(tag_name));10 try std.testing.expect(*const [13:0]u8 == @TypeOf(tag_name));
11 try std.testing.expectEqualStrings("TestEnumValue", tag_name);11 try std.testing.expect(std.mem.eql(u8, "TestEnumValue", tag_name));
12 try std.testing.expectEqualStrings("TestEnumValue", ptr_tag_name[0..tag_name.len]);12 try std.testing.expect(std.mem.eql(u8, "TestEnumValue", ptr_tag_name[0..tag_name.len]));
13}13}
1414
15const TestError = error{TestErrorCode};15const TestError = error{TestErrorCode};
...@@ -18,9 +18,9 @@ const ptr_error_name: [*:0]const u8 = error_name;...@@ -18,9 +18,9 @@ const ptr_error_name: [*:0]const u8 = error_name;
1818
19test "@errorName() returns a string literal" {19test "@errorName() returns a string literal" {
20 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong20 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
21 try std.testing.expectEqual(*const [13:0]u8, @TypeOf(error_name));21 try std.testing.expect(*const [13:0]u8 == @TypeOf(error_name));
22 try std.testing.expectEqualStrings("TestErrorCode", error_name);22 try std.testing.expect(std.mem.eql(u8, "TestErrorCode", error_name));
23 try std.testing.expectEqualStrings("TestErrorCode", ptr_error_name[0..error_name.len]);23 try std.testing.expect(std.mem.eql(u8, "TestErrorCode", ptr_error_name[0..error_name.len]));
24}24}
2525
26const TestType = struct {};26const TestType = struct {};
...@@ -29,9 +29,9 @@ const ptr_type_name: [*:0]const u8 = type_name;...@@ -29,9 +29,9 @@ const ptr_type_name: [*:0]const u8 = type_name;
2929
30test "@typeName() returns a string literal" {30test "@typeName() returns a string literal" {
31 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong31 if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong
32 try std.testing.expectEqual(*const [type_name.len:0]u8, @TypeOf(type_name));32 try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name));
33 try std.testing.expectEqualStrings("behavior.bugs.3779.TestType", type_name);33 try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", type_name));
34 try std.testing.expectEqualStrings("behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len]);34 try std.testing.expect(std.mem.eql(u8, "behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len]));
35}35}
3636
37const actual_contents = @embedFile("3779_file_to_embed.txt");37const actual_contents = @embedFile("3779_file_to_embed.txt");
...@@ -39,10 +39,10 @@ const ptr_actual_contents: [*:0]const u8 = actual_contents;...@@ -39,10 +39,10 @@ const ptr_actual_contents: [*:0]const u8 = actual_contents;
39const expected_contents = "hello zig\n";39const expected_contents = "hello zig\n";
4040
41test "@embedFile() returns a string literal" {41test "@embedFile() returns a string literal" {
42 try std.testing.expectEqual(*const [expected_contents.len:0]u8, @TypeOf(actual_contents));42 try std.testing.expect(*const [expected_contents.len:0]u8 == @TypeOf(actual_contents));
43 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));43 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));
44 try std.testing.expectEqualStrings(expected_contents, actual_contents);44 try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents));
45 try std.testing.expectEqualStrings(expected_contents, ptr_actual_contents[0..actual_contents.len]);45 try std.testing.expect(std.mem.eql(u8, expected_contents, ptr_actual_contents[0..actual_contents.len]));
46}46}
4747
48fn testFnForSrc() std.builtin.SourceLocation {48fn testFnForSrc() std.builtin.SourceLocation {
...@@ -51,9 +51,9 @@ fn testFnForSrc() std.builtin.SourceLocation {...@@ -51,9 +51,9 @@ fn testFnForSrc() std.builtin.SourceLocation {
5151
52test "@src() returns a struct containing 0-terminated string slices" {52test "@src() returns a struct containing 0-terminated string slices" {
53 const src = testFnForSrc();53 const src = testFnForSrc();
54 try std.testing.expectEqual([:0]const u8, @TypeOf(src.file));54 try std.testing.expect([:0]const u8 == @TypeOf(src.file));
55 try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig"));55 try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig"));
56 try std.testing.expectEqual([:0]const u8, @TypeOf(src.fn_name));56 try std.testing.expect([:0]const u8 == @TypeOf(src.fn_name));
57 try std.testing.expect(std.mem.endsWith(u8, src.fn_name, "testFnForSrc"));57 try std.testing.expect(std.mem.endsWith(u8, src.fn_name, "testFnForSrc"));
5858
59 const ptr_src_file: [*:0]const u8 = src.file;59 const ptr_src_file: [*:0]const u8 = src.file;