@@ -29,11 +29,11 @@ pub var zig_exe_path: []const u8 = undefined;
29
29
/// and then aborts when actual_error_union is not expected_error.
30
30
pub fn expectError (expected_error : anyerror , actual_error_union : anytype ) ! void {
31
31
if (actual_error_union ) | actual_payload | {
32
- std .debug .print ("expected error.{s}, found {any}" , .{ @errorName (expected_error ), actual_payload });
32
+ std .debug .print ("expected error.{s}, found {any}\n " , .{ @errorName (expected_error ), actual_payload });
33
33
return error .TestUnexpectedError ;
34
34
} else | actual_error | {
35
35
if (expected_error != actual_error ) {
36
- std .debug .print ("expected error.{s}, found error.{s}" , .{
36
+ std .debug .print ("expected error.{s}, found error.{s}\n " , .{
37
37
@errorName (expected_error ),
38
38
@errorName (actual_error ),
39
39
});
@@ -62,7 +62,7 @@ pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) !void {
62
62
63
63
.Type = > {
64
64
if (actual != expected ) {
65
- std .debug .print ("expected type {s}, found type {s}" , .{ @typeName (expected ), @typeName (actual ) });
65
+ std .debug .print ("expected type {s}, found type {s}\n " , .{ @typeName (expected ), @typeName (actual ) });
66
66
return error .TestExpectedEqual ;
67
67
}
68
68
},
@@ -78,7 +78,7 @@ pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) !void {
78
78
.ErrorSet ,
79
79
= > {
80
80
if (actual != expected ) {
81
- std .debug .print ("expected {}, found {}" , .{ expected , actual });
81
+ std .debug .print ("expected {}, found {}\n " , .{ expected , actual });
82
82
return error .TestExpectedEqual ;
83
83
}
84
84
},
@@ -87,17 +87,17 @@ pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) !void {
87
87
switch (pointer .size ) {
88
88
.One , .Many , .C = > {
89
89
if (actual != expected ) {
90
- std .debug .print ("expected {*}, found {*}" , .{ expected , actual });
90
+ std .debug .print ("expected {*}, found {*}\n " , .{ expected , actual });
91
91
return error .TestExpectedEqual ;
92
92
}
93
93
},
94
94
.Slice = > {
95
95
if (actual .ptr != expected .ptr ) {
96
- std .debug .print ("expected slice ptr {*}, found {*}" , .{ expected .ptr , actual .ptr });
96
+ std .debug .print ("expected slice ptr {*}, found {*}\n " , .{ expected .ptr , actual .ptr });
97
97
return error .TestExpectedEqual ;
98
98
}
99
99
if (actual .len != expected .len ) {
100
- std .debug .print ("expected slice len {}, found {}" , .{ expected .len , actual .len });
100
+ std .debug .print ("expected slice len {}, found {}\n " , .{ expected .len , actual .len });
101
101
return error .TestExpectedEqual ;
102
102
}
103
103
},
@@ -110,7 +110,7 @@ pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) !void {
110
110
var i : usize = 0 ;
111
111
while (i < vectorType .len ) : (i += 1 ) {
112
112
if (! std .meta .eql (expected [i ], actual [i ])) {
113
- std .debug .print ("index {} incorrect. expected {}, found {}" , .{ i , expected [i ], actual [i ] });
113
+ std .debug .print ("index {} incorrect. expected {}, found {}\n " , .{ i , expected [i ], actual [i ] });
114
114
return error .TestExpectedEqual ;
115
115
}
116
116
}
@@ -153,12 +153,12 @@ pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) !void {
153
153
if (actual ) | actual_payload | {
154
154
try expectEqual (expected_payload , actual_payload );
155
155
} else {
156
- std .debug .print ("expected {any}, found null" , .{expected_payload });
156
+ std .debug .print ("expected {any}, found null\n " , .{expected_payload });
157
157
return error .TestExpectedEqual ;
158
158
}
159
159
} else {
160
160
if (actual ) | actual_payload | {
161
- std .debug .print ("expected null, found {any}" , .{actual_payload });
161
+ std .debug .print ("expected null, found {any}\n " , .{actual_payload });
162
162
return error .TestExpectedEqual ;
163
163
}
164
164
}
@@ -169,12 +169,12 @@ pub fn expectEqual(expected: anytype, actual: @TypeOf(expected)) !void {
169
169
if (actual ) | actual_payload | {
170
170
try expectEqual (expected_payload , actual_payload );
171
171
} else | actual_err | {
172
- std .debug .print ("expected {any}, found {}" , .{ expected_payload , actual_err });
172
+ std .debug .print ("expected {any}, found {}\n " , .{ expected_payload , actual_err });
173
173
return error .TestExpectedEqual ;
174
174
}
175
175
} else | expected_err | {
176
176
if (actual ) | actual_payload | {
177
- std .debug .print ("expected {}, found {any}" , .{ expected_err , actual_payload });
177
+ std .debug .print ("expected {}, found {any}\n " , .{ expected_err , actual_payload });
178
178
return error .TestExpectedEqual ;
179
179
} else | actual_err | {
180
180
try expectEqual (expected_err , actual_err );
@@ -225,7 +225,7 @@ pub fn expectApproxEqAbs(expected: anytype, actual: @TypeOf(expected), tolerance
225
225
226
226
switch (@typeInfo (T )) {
227
227
.Float = > if (! math .approxEqAbs (T , expected , actual , tolerance )) {
228
- std .debug .print ("actual {}, not within absolute tolerance {} of expected {}" , .{ actual , tolerance , expected });
228
+ std .debug .print ("actual {}, not within absolute tolerance {} of expected {}\n " , .{ actual , tolerance , expected });
229
229
return error .TestExpectedApproxEqAbs ;
230
230
},
231
231
@@ -257,7 +257,7 @@ pub fn expectApproxEqRel(expected: anytype, actual: @TypeOf(expected), tolerance
257
257
258
258
switch (@typeInfo (T )) {
259
259
.Float = > if (! math .approxEqRel (T , expected , actual , tolerance )) {
260
- std .debug .print ("actual {}, not within relative tolerance {} of expected {}" , .{ actual , tolerance , expected });
260
+ std .debug .print ("actual {}, not within relative tolerance {} of expected {}\n " , .{ actual , tolerance , expected });
261
261
return error .TestExpectedApproxEqRel ;
262
262
},
263
263
@@ -292,13 +292,13 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
292
292
// If the child type is u8 and no weird bytes, we could print it as strings
293
293
// Even for the length difference, it would be useful to see the values of the slices probably.
294
294
if (expected .len != actual .len ) {
295
- std .debug .print ("slice lengths differ. expected {d}, found {d}" , .{ expected .len , actual .len });
295
+ std .debug .print ("slice lengths differ. expected {d}, found {d}\n " , .{ expected .len , actual .len });
296
296
return error .TestExpectedEqual ;
297
297
}
298
298
var i : usize = 0 ;
299
299
while (i < expected .len ) : (i += 1 ) {
300
300
if (! std .meta .eql (expected [i ], actual [i ])) {
301
- std .debug .print ("index {} incorrect. expected {any}, found {any}" , .{ i , expected [i ], actual [i ] });
301
+ std .debug .print ("index {} incorrect. expected {any}, found {any}\n " , .{ i , expected [i ], actual [i ] });
302
302
return error .TestExpectedEqual ;
303
303
}
304
304
}
0 commit comments