aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2021-05-04 20:47:26 +0300
committerVeikka Tuominen <git@vexu.eu>2021-05-08 15:15:30 +0300
commitfd77f2cfed81f3414c079909e079a812e23071c3 (patch)
treef9facf463ab13791faa0820c347371067ed27a79 /lib/std/meta
parent59f9253d94331cedd4d0518250c8094a064f6cd2 (diff)
downloadzig-fd77f2cfed81f3414c079909e079a812e23071c3.tar.gz
zig-fd77f2cfed81f3414c079909e079a812e23071c3.zip
std: update usage of std.testing
Diffstat (limited to 'lib/std/meta')
-rw-r--r--lib/std/meta/trailer_flags.zig14
-rw-r--r--lib/std/meta/trait.zig284
2 files changed, 149 insertions, 149 deletions
diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig
index 1697e9fe43..94f2043b00 100644
--- a/lib/std/meta/trailer_flags.zig
+++ b/lib/std/meta/trailer_flags.zig
@@ -146,7 +146,7 @@ test "TrailerFlags" {
b: bool,
c: u64,
});
- testing.expectEqual(u2, meta.Tag(Flags.FieldEnum));
+ try testing.expectEqual(u2, meta.Tag(Flags.FieldEnum));
var flags = Flags.init(.{
.b = true,
@@ -158,16 +158,16 @@ test "TrailerFlags" {
flags.set(slice.ptr, .b, false);
flags.set(slice.ptr, .c, 12345678);
- testing.expect(flags.get(slice.ptr, .a) == null);
- testing.expect(!flags.get(slice.ptr, .b).?);
- testing.expect(flags.get(slice.ptr, .c).? == 12345678);
+ try testing.expect(flags.get(slice.ptr, .a) == null);
+ try testing.expect(!flags.get(slice.ptr, .b).?);
+ try testing.expect(flags.get(slice.ptr, .c).? == 12345678);
flags.setMany(slice.ptr, .{
.b = true,
.c = 5678,
});
- testing.expect(flags.get(slice.ptr, .a) == null);
- testing.expect(flags.get(slice.ptr, .b).?);
- testing.expect(flags.get(slice.ptr, .c).? == 5678);
+ try testing.expect(flags.get(slice.ptr, .a) == null);
+ try testing.expect(flags.get(slice.ptr, .b).?);
+ try testing.expect(flags.get(slice.ptr, .c).? == 5678);
}
diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig
index 481bfe212b..2bf2e6a0a5 100644
--- a/lib/std/meta/trait.zig
+++ b/lib/std/meta/trait.zig
@@ -45,8 +45,8 @@ test "std.meta.trait.multiTrait" {
hasField("x"),
hasField("y"),
});
- testing.expect(isVector(Vector2));
- testing.expect(!isVector(u8));
+ try testing.expect(isVector(Vector2));
+ try testing.expect(!isVector(u8));
}
pub fn hasFn(comptime name: []const u8) TraitFn {
@@ -66,9 +66,9 @@ test "std.meta.trait.hasFn" {
pub fn useless() void {}
};
- testing.expect(hasFn("useless")(TestStruct));
- testing.expect(!hasFn("append")(TestStruct));
- testing.expect(!hasFn("useless")(u8));
+ try testing.expect(hasFn("useless")(TestStruct));
+ try testing.expect(!hasFn("append")(TestStruct));
+ try testing.expect(!hasFn("useless")(u8));
}
pub fn hasField(comptime name: []const u8) TraitFn {
@@ -96,11 +96,11 @@ test "std.meta.trait.hasField" {
value: u32,
};
- testing.expect(hasField("value")(TestStruct));
- testing.expect(!hasField("value")(*TestStruct));
- testing.expect(!hasField("x")(TestStruct));
- testing.expect(!hasField("x")(**TestStruct));
- testing.expect(!hasField("value")(u8));
+ try testing.expect(hasField("value")(TestStruct));
+ try testing.expect(!hasField("value")(*TestStruct));
+ try testing.expect(!hasField("x")(TestStruct));
+ try testing.expect(!hasField("x")(**TestStruct));
+ try testing.expect(!hasField("value")(u8));
}
pub fn is(comptime id: builtin.TypeId) TraitFn {
@@ -113,11 +113,11 @@ pub fn is(comptime id: builtin.TypeId) TraitFn {
}
test "std.meta.trait.is" {
- testing.expect(is(.Int)(u8));
- testing.expect(!is(.Int)(f32));
- testing.expect(is(.Pointer)(*u8));
- testing.expect(is(.Void)(void));
- testing.expect(!is(.Optional)(anyerror));
+ try testing.expect(is(.Int)(u8));
+ try testing.expect(!is(.Int)(f32));
+ try testing.expect(is(.Pointer)(*u8));
+ try testing.expect(is(.Void)(void));
+ try testing.expect(!is(.Optional)(anyerror));
}
pub fn isPtrTo(comptime id: builtin.TypeId) TraitFn {
@@ -131,9 +131,9 @@ pub fn isPtrTo(comptime id: builtin.TypeId) TraitFn {
}
test "std.meta.trait.isPtrTo" {
- testing.expect(!isPtrTo(.Struct)(struct {}));
- testing.expect(isPtrTo(.Struct)(*struct {}));
- testing.expect(!isPtrTo(.Struct)(**struct {}));
+ try testing.expect(!isPtrTo(.Struct)(struct {}));
+ try testing.expect(isPtrTo(.Struct)(*struct {}));
+ try testing.expect(!isPtrTo(.Struct)(**struct {}));
}
pub fn isSliceOf(comptime id: builtin.TypeId) TraitFn {
@@ -147,9 +147,9 @@ pub fn isSliceOf(comptime id: builtin.TypeId) TraitFn {
}
test "std.meta.trait.isSliceOf" {
- testing.expect(!isSliceOf(.Struct)(struct {}));
- testing.expect(isSliceOf(.Struct)([]struct {}));
- testing.expect(!isSliceOf(.Struct)([][]struct {}));
+ try testing.expect(!isSliceOf(.Struct)(struct {}));
+ try testing.expect(isSliceOf(.Struct)([]struct {}));
+ try testing.expect(!isSliceOf(.Struct)([][]struct {}));
}
///////////Strait trait Fns
@@ -170,9 +170,9 @@ test "std.meta.trait.isExtern" {
const TestExStruct = extern struct {};
const TestStruct = struct {};
- testing.expect(isExtern(TestExStruct));
- testing.expect(!isExtern(TestStruct));
- testing.expect(!isExtern(u8));
+ try testing.expect(isExtern(TestExStruct));
+ try testing.expect(!isExtern(TestStruct));
+ try testing.expect(!isExtern(u8));
}
pub fn isPacked(comptime T: type) bool {
@@ -188,9 +188,9 @@ test "std.meta.trait.isPacked" {
const TestPStruct = packed struct {};
const TestStruct = struct {};
- testing.expect(isPacked(TestPStruct));
- testing.expect(!isPacked(TestStruct));
- testing.expect(!isPacked(u8));
+ try testing.expect(isPacked(TestPStruct));
+ try testing.expect(!isPacked(TestStruct));
+ try testing.expect(!isPacked(u8));
}
pub fn isUnsignedInt(comptime T: type) bool {
@@ -201,10 +201,10 @@ pub fn isUnsignedInt(comptime T: type) bool {
}
test "isUnsignedInt" {
- testing.expect(isUnsignedInt(u32) == true);
- testing.expect(isUnsignedInt(comptime_int) == false);
- testing.expect(isUnsignedInt(i64) == false);
- testing.expect(isUnsignedInt(f64) == false);
+ try testing.expect(isUnsignedInt(u32) == true);
+ try testing.expect(isUnsignedInt(comptime_int) == false);
+ try testing.expect(isUnsignedInt(i64) == false);
+ try testing.expect(isUnsignedInt(f64) == false);
}
pub fn isSignedInt(comptime T: type) bool {
@@ -216,10 +216,10 @@ pub fn isSignedInt(comptime T: type) bool {
}
test "isSignedInt" {
- testing.expect(isSignedInt(u32) == false);
- testing.expect(isSignedInt(comptime_int) == true);
- testing.expect(isSignedInt(i64) == true);
- testing.expect(isSignedInt(f64) == false);
+ try testing.expect(isSignedInt(u32) == false);
+ try testing.expect(isSignedInt(comptime_int) == true);
+ try testing.expect(isSignedInt(i64) == true);
+ try testing.expect(isSignedInt(f64) == false);
}
pub fn isSingleItemPtr(comptime T: type) bool {
@@ -231,10 +231,10 @@ pub fn isSingleItemPtr(comptime T: type) bool {
test "std.meta.trait.isSingleItemPtr" {
const array = [_]u8{0} ** 10;
- comptime testing.expect(isSingleItemPtr(@TypeOf(&array[0])));
- comptime testing.expect(!isSingleItemPtr(@TypeOf(array)));
+ comptime try testing.expect(isSingleItemPtr(@TypeOf(&array[0])));
+ comptime try testing.expect(!isSingleItemPtr(@TypeOf(array)));
var runtime_zero: usize = 0;
- testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1])));
+ try testing.expect(!isSingleItemPtr(@TypeOf(array[runtime_zero..1])));
}
pub fn isManyItemPtr(comptime T: type) bool {
@@ -247,9 +247,9 @@ pub fn isManyItemPtr(comptime T: type) bool {
test "std.meta.trait.isManyItemPtr" {
const array = [_]u8{0} ** 10;
const mip = @ptrCast([*]const u8, &array[0]);
- testing.expect(isManyItemPtr(@TypeOf(mip)));
- testing.expect(!isManyItemPtr(@TypeOf(array)));
- testing.expect(!isManyItemPtr(@TypeOf(array[0..1])));
+ try testing.expect(isManyItemPtr(@TypeOf(mip)));
+ try testing.expect(!isManyItemPtr(@TypeOf(array)));
+ try testing.expect(!isManyItemPtr(@TypeOf(array[0..1])));
}
pub fn isSlice(comptime T: type) bool {
@@ -262,9 +262,9 @@ pub fn isSlice(comptime T: type) bool {
test "std.meta.trait.isSlice" {
const array = [_]u8{0} ** 10;
var runtime_zero: usize = 0;
- testing.expect(isSlice(@TypeOf(array[runtime_zero..])));
- testing.expect(!isSlice(@TypeOf(array)));
- testing.expect(!isSlice(@TypeOf(&array[0])));
+ try testing.expect(isSlice(@TypeOf(array[runtime_zero..])));
+ try testing.expect(!isSlice(@TypeOf(array)));
+ try testing.expect(!isSlice(@TypeOf(&array[0])));
}
pub fn isIndexable(comptime T: type) bool {
@@ -283,12 +283,12 @@ test "std.meta.trait.isIndexable" {
const vector: meta.Vector(2, u32) = [_]u32{0} ** 2;
const tuple = .{ 1, 2, 3 };
- testing.expect(isIndexable(@TypeOf(array)));
- testing.expect(isIndexable(@TypeOf(&array)));
- testing.expect(isIndexable(@TypeOf(slice)));
- testing.expect(!isIndexable(meta.Child(@TypeOf(slice))));
- testing.expect(isIndexable(@TypeOf(vector)));
- testing.expect(isIndexable(@TypeOf(tuple)));
+ try testing.expect(isIndexable(@TypeOf(array)));
+ try testing.expect(isIndexable(@TypeOf(&array)));
+ try testing.expect(isIndexable(@TypeOf(slice)));
+ try testing.expect(!isIndexable(meta.Child(@TypeOf(slice))));
+ try testing.expect(isIndexable(@TypeOf(vector)));
+ try testing.expect(isIndexable(@TypeOf(tuple)));
}
pub fn isNumber(comptime T: type) bool {
@@ -317,13 +317,13 @@ test "std.meta.trait.isNumber" {
number: u8,
};
- testing.expect(isNumber(u32));
- testing.expect(isNumber(f32));
- testing.expect(isNumber(u64));
- testing.expect(isNumber(@TypeOf(102)));
- testing.expect(isNumber(@TypeOf(102.123)));
- testing.expect(!isNumber([]u8));
- testing.expect(!isNumber(NotANumber));
+ try testing.expect(isNumber(u32));
+ try testing.expect(isNumber(f32));
+ try testing.expect(isNumber(u64));
+ try testing.expect(isNumber(@TypeOf(102)));
+ try testing.expect(isNumber(@TypeOf(102.123)));
+ try testing.expect(!isNumber([]u8));
+ try testing.expect(!isNumber(NotANumber));
}
pub fn isIntegral(comptime T: type) bool {
@@ -334,12 +334,12 @@ pub fn isIntegral(comptime T: type) bool {
}
test "isIntegral" {
- testing.expect(isIntegral(u32));
- testing.expect(!isIntegral(f32));
- testing.expect(isIntegral(@TypeOf(102)));
- testing.expect(!isIntegral(@TypeOf(102.123)));
- testing.expect(!isIntegral(*u8));
- testing.expect(!isIntegral([]u8));
+ try testing.expect(isIntegral(u32));
+ try testing.expect(!isIntegral(f32));
+ try testing.expect(isIntegral(@TypeOf(102)));
+ try testing.expect(!isIntegral(@TypeOf(102.123)));
+ try testing.expect(!isIntegral(*u8));
+ try testing.expect(!isIntegral([]u8));
}
pub fn isFloat(comptime T: type) bool {
@@ -350,12 +350,12 @@ pub fn isFloat(comptime T: type) bool {
}
test "isFloat" {
- testing.expect(!isFloat(u32));
- testing.expect(isFloat(f32));
- testing.expect(!isFloat(@TypeOf(102)));
- testing.expect(isFloat(@TypeOf(102.123)));
- testing.expect(!isFloat(*f64));
- testing.expect(!isFloat([]f32));
+ try testing.expect(!isFloat(u32));
+ try testing.expect(isFloat(f32));
+ try testing.expect(!isFloat(@TypeOf(102)));
+ try testing.expect(isFloat(@TypeOf(102.123)));
+ try testing.expect(!isFloat(*f64));
+ try testing.expect(!isFloat([]f32));
}
pub fn isConstPtr(comptime T: type) bool {
@@ -366,10 +366,10 @@ pub fn isConstPtr(comptime T: type) bool {
test "std.meta.trait.isConstPtr" {
var t = @as(u8, 0);
const c = @as(u8, 0);
- testing.expect(isConstPtr(*const @TypeOf(t)));
- testing.expect(isConstPtr(@TypeOf(&c)));
- testing.expect(!isConstPtr(*@TypeOf(t)));
- testing.expect(!isConstPtr(@TypeOf(6)));
+ try testing.expect(isConstPtr(*const @TypeOf(t)));
+ try testing.expect(isConstPtr(@TypeOf(&c)));
+ try testing.expect(!isConstPtr(*@TypeOf(t)));
+ try testing.expect(!isConstPtr(@TypeOf(6)));
}
pub fn isContainer(comptime T: type) bool {
@@ -389,10 +389,10 @@ test "std.meta.trait.isContainer" {
B,
};
- testing.expect(isContainer(TestStruct));
- testing.expect(isContainer(TestUnion));
- testing.expect(isContainer(TestEnum));
- testing.expect(!isContainer(u8));
+ try testing.expect(isContainer(TestStruct));
+ try testing.expect(isContainer(TestUnion));
+ try testing.expect(isContainer(TestEnum));
+ try testing.expect(!isContainer(u8));
}
pub fn isTuple(comptime T: type) bool {
@@ -403,9 +403,9 @@ test "std.meta.trait.isTuple" {
const t1 = struct {};
const t2 = .{ .a = 0 };
const t3 = .{ 1, 2, 3 };
- testing.expect(!isTuple(t1));
- testing.expect(!isTuple(@TypeOf(t2)));
- testing.expect(isTuple(@TypeOf(t3)));
+ try testing.expect(!isTuple(t1));
+ try testing.expect(!isTuple(@TypeOf(t2)));
+ try testing.expect(isTuple(@TypeOf(t3)));
}
/// Returns true if the passed type will coerce to []const u8.
@@ -449,41 +449,41 @@ pub fn isZigString(comptime T: type) bool {
}
test "std.meta.trait.isZigString" {
- testing.expect(isZigString([]const u8));
- testing.expect(isZigString([]u8));
- testing.expect(isZigString([:0]const u8));
- testing.expect(isZigString([:0]u8));
- testing.expect(isZigString([:5]const u8));
- testing.expect(isZigString([:5]u8));
- testing.expect(isZigString(*const [0]u8));
- testing.expect(isZigString(*[0]u8));
- testing.expect(isZigString(*const [0:0]u8));
- testing.expect(isZigString(*[0:0]u8));
- testing.expect(isZigString(*const [0:5]u8));
- testing.expect(isZigString(*[0:5]u8));
- testing.expect(isZigString(*const [10]u8));
- testing.expect(isZigString(*[10]u8));
- testing.expect(isZigString(*const [10:0]u8));
- testing.expect(isZigString(*[10:0]u8));
- testing.expect(isZigString(*const [10:5]u8));
- testing.expect(isZigString(*[10:5]u8));
-
- testing.expect(!isZigString(u8));
- testing.expect(!isZigString([4]u8));
- testing.expect(!isZigString([4:0]u8));
- testing.expect(!isZigString([*]const u8));
- testing.expect(!isZigString([*]const [4]u8));
- testing.expect(!isZigString([*c]const u8));
- testing.expect(!isZigString([*c]const [4]u8));
- testing.expect(!isZigString([*:0]const u8));
- testing.expect(!isZigString([*:0]const u8));
- testing.expect(!isZigString(*[]const u8));
- testing.expect(!isZigString(?[]const u8));
- testing.expect(!isZigString(?*const [4]u8));
- testing.expect(!isZigString([]allowzero u8));
- testing.expect(!isZigString([]volatile u8));
- testing.expect(!isZigString(*allowzero [4]u8));
- testing.expect(!isZigString(*volatile [4]u8));
+ try testing.expect(isZigString([]const u8));
+ try testing.expect(isZigString([]u8));
+ try testing.expect(isZigString([:0]const u8));
+ try testing.expect(isZigString([:0]u8));
+ try testing.expect(isZigString([:5]const u8));
+ try testing.expect(isZigString([:5]u8));
+ try testing.expect(isZigString(*const [0]u8));
+ try testing.expect(isZigString(*[0]u8));
+ try testing.expect(isZigString(*const [0:0]u8));
+ try testing.expect(isZigString(*[0:0]u8));
+ try testing.expect(isZigString(*const [0:5]u8));
+ try testing.expect(isZigString(*[0:5]u8));
+ try testing.expect(isZigString(*const [10]u8));
+ try testing.expect(isZigString(*[10]u8));
+ try testing.expect(isZigString(*const [10:0]u8));
+ try testing.expect(isZigString(*[10:0]u8));
+ try testing.expect(isZigString(*const [10:5]u8));
+ try testing.expect(isZigString(*[10:5]u8));
+
+ try testing.expect(!isZigString(u8));
+ try testing.expect(!isZigString([4]u8));
+ try testing.expect(!isZigString([4:0]u8));
+ try testing.expect(!isZigString([*]const u8));
+ try testing.expect(!isZigString([*]const [4]u8));
+ try testing.expect(!isZigString([*c]const u8));
+ try testing.expect(!isZigString([*c]const [4]u8));
+ try testing.expect(!isZigString([*:0]const u8));
+ try testing.expect(!isZigString([*:0]const u8));
+ try testing.expect(!isZigString(*[]const u8));
+ try testing.expect(!isZigString(?[]const u8));
+ try testing.expect(!isZigString(?*const [4]u8));
+ try testing.expect(!isZigString([]allowzero u8));
+ try testing.expect(!isZigString([]volatile u8));
+ try testing.expect(!isZigString(*allowzero [4]u8));
+ try testing.expect(!isZigString(*volatile [4]u8));
}
pub fn hasDecls(comptime T: type, comptime names: anytype) bool {
@@ -505,11 +505,11 @@ test "std.meta.trait.hasDecls" {
const tuple = .{ "a", "b", "c" };
- testing.expect(!hasDecls(TestStruct1, .{"a"}));
- testing.expect(hasDecls(TestStruct2, .{ "a", "b" }));
- testing.expect(hasDecls(TestStruct2, .{ "a", "b", "useless" }));
- testing.expect(!hasDecls(TestStruct2, .{ "a", "b", "c" }));
- testing.expect(!hasDecls(TestStruct2, tuple));
+ try testing.expect(!hasDecls(TestStruct1, .{"a"}));
+ try testing.expect(hasDecls(TestStruct2, .{ "a", "b" }));
+ try testing.expect(hasDecls(TestStruct2, .{ "a", "b", "useless" }));
+ try testing.expect(!hasDecls(TestStruct2, .{ "a", "b", "c" }));
+ try testing.expect(!hasDecls(TestStruct2, tuple));
}
pub fn hasFields(comptime T: type, comptime names: anytype) bool {
@@ -531,11 +531,11 @@ test "std.meta.trait.hasFields" {
const tuple = .{ "a", "b", "c" };
- testing.expect(!hasFields(TestStruct1, .{"a"}));
- testing.expect(hasFields(TestStruct2, .{ "a", "b" }));
- testing.expect(hasFields(TestStruct2, .{ "a", "b", "c" }));
- testing.expect(hasFields(TestStruct2, tuple));
- testing.expect(!hasFields(TestStruct2, .{ "a", "b", "useless" }));
+ try testing.expect(!hasFields(TestStruct1, .{"a"}));
+ try testing.expect(hasFields(TestStruct2, .{ "a", "b" }));
+ try testing.expect(hasFields(TestStruct2, .{ "a", "b", "c" }));
+ try testing.expect(hasFields(TestStruct2, tuple));
+ try testing.expect(!hasFields(TestStruct2, .{ "a", "b", "useless" }));
}
pub fn hasFunctions(comptime T: type, comptime names: anytype) bool {
@@ -555,10 +555,10 @@ test "std.meta.trait.hasFunctions" {
const tuple = .{ "a", "b", "c" };
- testing.expect(!hasFunctions(TestStruct1, .{"a"}));
- testing.expect(hasFunctions(TestStruct2, .{ "a", "b" }));
- testing.expect(!hasFunctions(TestStruct2, .{ "a", "b", "c" }));
- testing.expect(!hasFunctions(TestStruct2, tuple));
+ try testing.expect(!hasFunctions(TestStruct1, .{"a"}));
+ try testing.expect(hasFunctions(TestStruct2, .{ "a", "b" }));
+ try testing.expect(!hasFunctions(TestStruct2, .{ "a", "b", "c" }));
+ try testing.expect(!hasFunctions(TestStruct2, tuple));
}
/// True if every value of the type `T` has a unique bit pattern representing it.
@@ -606,65 +606,65 @@ test "std.meta.trait.hasUniqueRepresentation" {
b: u32,
};
- testing.expect(hasUniqueRepresentation(TestStruct1));
+ try testing.expect(hasUniqueRepresentation(TestStruct1));
const TestStruct2 = struct {
a: u32,
b: u16,
};
- testing.expect(!hasUniqueRepresentation(TestStruct2));
+ try testing.expect(!hasUniqueRepresentation(TestStruct2));
const TestStruct3 = struct {
a: u32,
b: u32,
};
- testing.expect(hasUniqueRepresentation(TestStruct3));
+ try testing.expect(hasUniqueRepresentation(TestStruct3));
const TestStruct4 = struct { a: []const u8 };
- testing.expect(!hasUniqueRepresentation(TestStruct4));
+ try testing.expect(!hasUniqueRepresentation(TestStruct4));
const TestStruct5 = struct { a: TestStruct4 };
- testing.expect(!hasUniqueRepresentation(TestStruct5));
+ try testing.expect(!hasUniqueRepresentation(TestStruct5));
const TestUnion1 = packed union {
a: u32,
b: u16,
};
- testing.expect(!hasUniqueRepresentation(TestUnion1));
+ try testing.expect(!hasUniqueRepresentation(TestUnion1));
const TestUnion2 = extern union {
a: u32,
b: u16,
};
- testing.expect(!hasUniqueRepresentation(TestUnion2));
+ try testing.expect(!hasUniqueRepresentation(TestUnion2));
const TestUnion3 = union {
a: u32,
b: u16,
};
- testing.expect(!hasUniqueRepresentation(TestUnion3));
+ try testing.expect(!hasUniqueRepresentation(TestUnion3));
const TestUnion4 = union(enum) {
a: u32,
b: u16,
};
- testing.expect(!hasUniqueRepresentation(TestUnion4));
+ try testing.expect(!hasUniqueRepresentation(TestUnion4));
inline for ([_]type{ i0, u8, i16, u32, i64 }) |T| {
- testing.expect(hasUniqueRepresentation(T));
+ try testing.expect(hasUniqueRepresentation(T));
}
inline for ([_]type{ i1, u9, i17, u33, i24 }) |T| {
- testing.expect(!hasUniqueRepresentation(T));
+ try testing.expect(!hasUniqueRepresentation(T));
}
- testing.expect(!hasUniqueRepresentation([]u8));
- testing.expect(!hasUniqueRepresentation([]const u8));
+ try testing.expect(!hasUniqueRepresentation([]u8));
+ try testing.expect(!hasUniqueRepresentation([]const u8));
}