Skip to content

Commit 25afcd9

Browse files
committed
Add test for slice lowering
1 parent e925574 commit 25afcd9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/lowering/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,29 @@ fn refs() {
533533
}
534534
}
535535
}
536+
537+
#[test]
538+
fn slices() {
539+
lowering_success! {
540+
program {
541+
trait Foo { }
542+
543+
impl Foo for [i32] { }
544+
impl<T> Foo for [T] { }
545+
546+
impl Foo for [[i32]] { }
547+
impl Foo for [()] { }
548+
}
549+
}
550+
551+
lowering_error! {
552+
program {
553+
trait Foo { }
554+
impl Foo for [] {}
555+
}
556+
557+
error_msg {
558+
"parse error: UnrecognizedToken { token: (29, Token(30, \"]\"), 30), expected: [\"\\\"&\\\"\", \"\\\"(\\\"\", \"\\\"*\\\"\", \"\\\"<\\\"\", \"\\\"[\\\"\", \"\\\"bool\\\"\", \"\\\"char\\\"\", \"\\\"dyn\\\"\", \"\\\"f32\\\"\", \"\\\"f64\\\"\", \"\\\"fn\\\"\", \"\\\"for\\\"\", \"\\\"i128\\\"\", \"\\\"i16\\\"\", \"\\\"i32\\\"\", \"\\\"i64\\\"\", \"\\\"i8\\\"\", \"\\\"isize\\\"\", \"\\\"u128\\\"\", \"\\\"u16\\\"\", \"\\\"u32\\\"\", \"\\\"u64\\\"\", \"\\\"u8\\\"\", \"\\\"usize\\\"\", \"r#\\\"([A-Za-z]|_)([A-Za-z0-9]|_)*\\\"#\"] }"
559+
}
560+
}
561+
}

0 commit comments

Comments
 (0)