Skip to content

Commit

Permalink
test slice patterns with exclusive range patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 19, 2017
1 parent 63a8eb9 commit 98fef41
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs
@@ -0,0 +1,18 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(exclusive_range_pattern)]

fn main() {
match [5..4, 99..105, 43..44] {
[_, 99.., _] => {}, //~ ERROR unexpected token: `,`
_ => {},
}
}
18 changes: 18 additions & 0 deletions src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs
@@ -0,0 +1,18 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(exclusive_range_pattern)]

fn main() {
match [5..4, 99..105, 43..44] {
[_, 99..] => {}, //~ ERROR unexpected token: `]`
_ => {},
}
}
18 changes: 18 additions & 0 deletions src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs
@@ -0,0 +1,18 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(exclusive_range_pattern)]

fn main() {
match [5..4, 99..105, 43..44] {
[..9, 99..100, _] => {}, //~ ERROR expected one of `,` or `]`, found `9`
_ => {},
}
}

0 comments on commit 98fef41

Please sign in to comment.