]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/issue-13027.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / issue-13027.rs
index 8acaa889a0490a7fcc2f7cfa1d9643761f54318f..1f61da2f424f0c4337e8194b49f84a5c18cebab1 100644 (file)
@@ -7,6 +7,8 @@
 // <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.
+//
+// ignore-lexer-test FIXME #15877
 
 // Tests that match expression handles overlapped literal and range
 // properly in the presence of guard function.
@@ -27,145 +29,145 @@ pub fn main() {
 }
 
 fn lit_shadow_range() {
-    assert_eq!(2i, match 1 {
-        1 if false => 1,
-        1..2 => 2,
+    assert_eq!(2i, match 1i {
+        1 if false => 1i,
+        1...2 => 2,
         _ => 3
     });
 
     let x = 0i;
     assert_eq!(2i, match x+1 {
-        0 => 0,
+        0 => 0i,
         1 if false => 1,
-        1..2 => 2,
+        1...2 => 2,
         _ => 3
     });
 
     assert_eq!(2i, match val() {
-        1 if false => 1,
-        1..2 => 2,
+        1 if false => 1i,
+        1...2 => 2,
         _ => 3
     });
 
     assert_eq!(2i, match CONST {
-        0 => 0,
+        0 => 0i,
         1 if false => 1,
-        1..2 => 2,
+        1...2 => 2,
         _ => 3
     });
 
     // value is out of the range of second arm, should match wildcard pattern
-    assert_eq!(3i, match 3 {
-        1 if false => 1,
-        1..2 => 2,
+    assert_eq!(3i, match 3i {
+        1 if false => 1i,
+        1...2 => 2,
         _ => 3
     });
 }
 
 fn range_shadow_lit() {
-    assert_eq!(2i, match 1 {
-        1..2 if false => 1,
+    assert_eq!(2i, match 1i {
+        1...2 if false => 1i,
         1 => 2,
         _ => 3
     });
 
     let x = 0i;
     assert_eq!(2i, match x+1 {
-        0 => 0,
-        1..2 if false => 1,
+        0 => 0i,
+        1...2 if false => 1,
         1 => 2,
         _ => 3
     });
 
     assert_eq!(2i, match val() {
-        1..2 if false => 1,
+        1...2 if false => 1i,
         1 => 2,
         _ => 3
     });
 
     assert_eq!(2i, match CONST {
-        0 => 0,
-        1..2 if false => 1,
+        0 => 0i,
+        1...2 if false => 1,
         1 => 2,
         _ => 3
     });
 
     // ditto
-    assert_eq!(3i, match 3 {
-        1..2 if false => 1,
+    assert_eq!(3i, match 3i {
+        1...2 if false => 1i,
         1 => 2,
         _ => 3
     });
 }
 
 fn range_shadow_range() {
-    assert_eq!(2i, match 1 {
-        0..2 if false => 1,
-        1..3 => 2,
+    assert_eq!(2i, match 1i {
+        0...2 if false => 1i,
+        1...3 => 2,
         _ => 3,
     });
 
     let x = 0i;
     assert_eq!(2i, match x+1 {
         100 => 0,
-        0..2 if false => 1,
-        1..3 => 2,
+        0...2 if false => 1,
+        1...3 => 2,
         _ => 3,
     });
 
     assert_eq!(2i, match val() {
-        0..2 if false => 1,
-        1..3 => 2,
+        0...2 if false => 1,
+        1...3 => 2,
         _ => 3,
     });
 
     assert_eq!(2i, match CONST {
         100 => 0,
-        0..2 if false => 1,
-        1..3 => 2,
+        0...2 if false => 1,
+        1...3 => 2,
         _ => 3,
     });
 
     // ditto
-    assert_eq!(3i, match 5 {
-        0..2 if false => 1,
-        1..3 => 2,
+    assert_eq!(3i, match 5i {
+        0...2 if false => 1i,
+        1...3 => 2,
         _ => 3,
     });
 }
 
 fn multi_pats_shadow_lit() {
-    assert_eq!(2i, match 1 {
-        100 => 0,
-        0 | 1..10 if false => 1,
+    assert_eq!(2i, match 1i {
+        100 => 0i,
+        0 | 1...10 if false => 1,
         1 => 2,
         _ => 3,
     });
 }
 
 fn multi_pats_shadow_range() {
-    assert_eq!(2i, match 1 {
-        100 => 0,
-        0 | 1..10 if false => 1,
-        1..3 => 2,
+    assert_eq!(2i, match 1i {
+        100 => 0i,
+        0 | 1...10 if false => 1,
+        1...3 => 2,
         _ => 3,
     });
 }
 
 fn lit_shadow_multi_pats() {
-    assert_eq!(2i, match 1 {
-        100 => 0,
+    assert_eq!(2i, match 1i {
+        100 => 0i,
         1 if false => 1,
-        0 | 1..10 => 2,
+        0 | 1...10 => 2,
         _ => 3,
     });
 }
 
 fn range_shadow_multi_pats() {
-    assert_eq!(2i, match 1 {
-        100 => 0,
-        1..3 if false => 1,
-        0 | 1..10 => 2,
+    assert_eq!(2i, match 1i {
+        100 => 0i,
+        1...3 if false => 1,
+        0 | 1...10 => 2,
         _ => 3,
     });
 }
@@ -177,10 +179,10 @@ enum Foo {
     // This test basically mimics how trace_macros! macro is implemented,
     // which is a rare combination of vector patterns, multiple wild-card
     // patterns and guard functions.
-    let r = match [Bar(0, false)].as_slice() {
-        [Bar(_, pred)] if pred => 1i,
-        [Bar(_, pred)] if !pred => 2i,
+    let r = match [Foo::Bar(0, false)].as_slice() {
+        [Foo::Bar(_, pred)] if pred => 1i,
+        [Foo::Bar(_, pred)] if !pred => 2i,
         _ => 0i,
     };
-    assert_eq!(2, r);
+    assert_eq!(2i, r);
 }