Skip to content

Commit

Permalink
Add test for uint and negative literals as discriminants
Browse files Browse the repository at this point in the history
  • Loading branch information
kemurphy committed Jul 25, 2013
1 parent 1c3dc29 commit e9233d5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/run-pass/enum-discr.rs
@@ -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);
}

0 comments on commit e9233d5

Please sign in to comment.