Skip to content

Commit 19a9a47

Browse files
committed
test: Add regression test for #1659
1 parent ba7299b commit 19a9a47

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/run-pass/tag-variant-disr-val.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ enum color {
55
black = 0x000000,
66
white = 0xFFFFFF,
77
imaginary = -1,
8+
purple = 1 << 1,
9+
orange = 8 >> 1
810
}
911

1012
fn main() {
@@ -14,6 +16,8 @@ fn main() {
1416
test_color(black, 0x000000, "black");
1517
test_color(white, 0xFFFFFF, "white");
1618
test_color(imaginary, -1, "imaginary");
19+
test_color(purple, 2, "purple");
20+
test_color(orange, 4, "orange");
1721
}
1822

1923
fn test_color(color: color, val: int, name: str) unsafe {
@@ -32,6 +36,8 @@ fn get_color_alt(color: color) -> str {
3236
black {"black"}
3337
white {"white"}
3438
imaginary {"imaginary"}
39+
purple {"purple"}
40+
orange {"orange"}
3541
_ {"unknown"}
3642
}
3743
}
@@ -43,6 +49,8 @@ fn get_color_if(color: color) -> str {
4349
else if color == black {"black"}
4450
else if color == white {"white"}
4551
else if color == imaginary {"imaginary"}
52+
else if color == purple {"purple"}
53+
else if color == orange {"orange"}
4654
else {"unknown"}
4755
}
4856

0 commit comments

Comments
 (0)