Add test for uint and negative literals as discriminants

This commit is contained in:
Kevin Murphy 2013-07-23 23:32:10 -04:00
parent 1c3dc294ce
commit e9233d55c8

View File

@ -0,0 +1,20 @@
enum Animal {
Cat = 0u,
Dog = 1u,
Horse = 2u,
Snake = 3u
}
enum Hero {
Batman = -1,
Superman = -2,
Ironman = -3,
Spiderman = -4
}
fn main() {
let pet: Animal = Snake;
let hero: Hero = Superman;
assert!(pet as uint == 3);
assert!(hero as int == -2);
}