@@ -20,8 +20,8 @@ enum Test {
2020
2121fn test ( foo : & [ Option < Test > ] ) -> MatchArm {
2222 match foo {
23- [ .., Some ( Test :: Foo | Test :: Qux ) ] => MatchArm :: Arm ( 0 ) ,
24- [ Some ( Test :: Foo ) , .., Some ( Test :: Bar | Test :: Baz ) ] => MatchArm :: Arm ( 1 ) ,
23+ [ .., Some ( Test :: Qux | Test :: Foo ) ] => MatchArm :: Arm ( 0 ) ,
24+ [ Some ( Test :: Foo ) , .., Some ( Test :: Baz | Test :: Bar ) ] => MatchArm :: Arm ( 1 ) ,
2525 [ .., Some ( Test :: Bar | Test :: Baz ) , _] => MatchArm :: Arm ( 2 ) ,
2626 _ => MatchArm :: Wild ,
2727 }
@@ -35,8 +35,18 @@ fn main() {
3535 Some ( Test :: Qux ) ,
3636 ] ;
3737
38+ // path 1a
3839 assert_eq ! ( test( & foo) , MatchArm :: Arm ( 0 ) ) ;
40+ // path 1b
41+ assert_eq ! ( test( & [ Some ( Test :: Bar ) , Some ( Test :: Foo ) ] ) , MatchArm :: Arm ( 0 ) ) ;
42+ // path 2a
3943 assert_eq ! ( test( & foo[ ..3 ] ) , MatchArm :: Arm ( 1 ) ) ;
44+ // path 2b
45+ assert_eq ! ( test( & [ Some ( Test :: Foo ) , Some ( Test :: Foo ) , Some ( Test :: Bar ) ] ) , MatchArm :: Arm ( 1 ) ) ;
46+ // path 3a
4047 assert_eq ! ( test( & foo[ 1 ..3 ] ) , MatchArm :: Arm ( 2 ) ) ;
48+ // path 3b
49+ assert_eq ! ( test( & [ Some ( Test :: Bar ) , Some ( Test :: Baz ) , Some ( Test :: Baz ) , Some ( Test :: Bar ) ] ) , MatchArm :: Arm ( 2 ) ) ;
50+ // path 4
4151 assert_eq ! ( test( & foo[ 4 ..] ) , MatchArm :: Wild ) ;
4252}
0 commit comments