aboutsummaryrefslogtreecommitdiff
path: root/test/cases
diff options
context:
space:
mode:
Diffstat (limited to 'test/cases')
-rw-r--r--test/cases/cast.zig4
-rw-r--r--test/cases/error.zig10
-rw-r--r--test/cases/type_info.zig2
3 files changed, 8 insertions, 8 deletions
diff --git a/test/cases/cast.zig b/test/cases/cast.zig
index 0b79f0df48..156835bcb3 100644
--- a/test/cases/cast.zig
+++ b/test/cases/cast.zig
@@ -140,8 +140,8 @@ test "explicit cast from integer to error type" {
comptime testCastIntToErr(error.ItBroke);
}
fn testCastIntToErr(err: error) void {
- const x = usize(err);
- const y = error(x);
+ const x = @errorToInt(err);
+ const y = @intToError(x);
assert(error.ItBroke == y);
}
diff --git a/test/cases/error.zig b/test/cases/error.zig
index 95890d8384..45971fd40d 100644
--- a/test/cases/error.zig
+++ b/test/cases/error.zig
@@ -31,8 +31,8 @@ test "@errorName" {
}
test "error values" {
- const a = i32(error.err1);
- const b = i32(error.err2);
+ const a = @errorToInt(error.err1);
+ const b = @errorToInt(error.err2);
assert(a != b);
}
@@ -147,14 +147,14 @@ test "syntax: optional operator in front of error union operator" {
}
test "comptime err to int of error set with only 1 possible value" {
- testErrToIntWithOnePossibleValue(error.A, u32(error.A));
- comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A));
+ testErrToIntWithOnePossibleValue(error.A, @errorToInt(error.A));
+ comptime testErrToIntWithOnePossibleValue(error.A, @errorToInt(error.A));
}
fn testErrToIntWithOnePossibleValue(
x: error{A},
comptime value: u32,
) void {
- if (u32(x) != value) {
+ if (@errorToInt(x) != value) {
@compileError("bad");
}
}
diff --git a/test/cases/type_info.zig b/test/cases/type_info.zig
index 1bc58b14e1..46fb3852f3 100644
--- a/test/cases/type_info.zig
+++ b/test/cases/type_info.zig
@@ -130,7 +130,7 @@ fn testErrorSet() void {
assert(TypeId(error_set_info) == TypeId.ErrorSet);
assert(error_set_info.ErrorSet.errors.len == 3);
assert(mem.eql(u8, error_set_info.ErrorSet.errors[0].name, "First"));
- assert(error_set_info.ErrorSet.errors[2].value == usize(TestErrorSet.Third));
+ assert(error_set_info.ErrorSet.errors[2].value == @errorToInt(TestErrorSet.Third));
const error_union_info = @typeInfo(TestErrorSet!usize);
assert(TypeId(error_union_info) == TypeId.ErrorUnion);