Skip to content

Commit 98ae8ad

Browse files
committed
Add test for univariant enum size
1 parent a1d11bc commit 98ae8ad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/run-pass/type-sizes.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ struct w {a: int, b: ()}
1818
struct x {a: int, b: (), c: ()}
1919
struct y {x: int}
2020

21+
enum c1 {
22+
c1
23+
}
24+
25+
enum c2 {
26+
c2 = 1
27+
}
28+
2129
pub fn main() {
2230
assert_eq!(size_of::<u8>(), 1 as uint);
2331
assert_eq!(size_of::<u32>(), 4 as uint);
@@ -34,4 +42,8 @@ pub fn main() {
3442
assert_eq!(size_of::<w>(), size_of::<int>());
3543
assert_eq!(size_of::<x>(), size_of::<int>());
3644
assert_eq!(size_of::<int>(), size_of::<y>());
45+
46+
// Make sure enum sizes are correct
47+
assert_eq!(size_of::<c1>(), 0 as uint);
48+
assert_eq!(size_of::<c2>(), 1 as uint);
3749
}

0 commit comments

Comments
 (0)