aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/enum.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior/enum.zig')
-rw-r--r--test/behavior/enum.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig
index 5cb89ffa32..acd8d17302 100644
--- a/test/behavior/enum.zig
+++ b/test/behavior/enum.zig
@@ -1169,3 +1169,11 @@ test "Non-exhaustive enum with nonstandard int size behaves correctly" {
const E = enum(u15) { _ };
try expect(@sizeOf(E) == @sizeOf(u15));
}
+
+test "runtime int to enum with one possible value" {
+ const E = enum { one };
+ var runtime: usize = 0;
+ if (@intToEnum(E, runtime) != .one) {
+ @compileError("test failed");
+ }
+}