Add tests to exercise the "pattern has N field(s), but" error patterns.

This commit is contained in:
Lindsey Kuper 2012-06-21 15:02:43 -07:00
parent abfa8164cd
commit 0fe9c0a9d1
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,16 @@
fn main() {
enum color {
rgb(uint, uint, uint),
cmyk(uint, uint, uint, uint),
no_color,
}
fn foo(c: color) {
alt c {
rgb(_, _, _) { }
cmyk(_, _, _, _) { }
no_color(_) { }
//!^ ERROR this pattern has 1 field, but the corresponding variant has no fields
}
}
}

View File

@ -0,0 +1,16 @@
fn main() {
enum color {
rgb(uint, uint, uint),
cmyk(uint, uint, uint, uint),
no_color,
}
fn foo(c: color) {
alt c {
rgb(_, _) { }
//!^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
cmyk(_, _, _, _) { }
no_color { }
}
}
}