aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/basic.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index 186418b69c..0c2cfbc3d5 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -693,3 +693,9 @@ test "variable name containing underscores does not shadow int primitive" {
_ = u6__4;
_ = i2_04_8;
}
+
+test "if expression type coercion" {
+ var cond: bool = true;
+ const x: u16 = if (cond) 1 else 0;
+ try expect(@as(u16, x) == 1);
+}