Skip to content

Commit 3a089b2

Browse files
committed
Add another test, a run-pass one
1 parent 27a8c35 commit 3a089b2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! Verify that matching against a constant array pattern produces correct
2+
//! results at runtime, complementing the MIR test in
3+
//! `tests/mir-opt/building/match/aggregate_array_eq.rs` which checks that
4+
//! a single aggregate `PartialEq::eq` call is emitted.
5+
//@ run-pass
6+
7+
fn array_match(x: [u8; 4]) -> bool {
8+
matches!(x, [1, 2, 3, 4])
9+
}
10+
11+
fn main() {
12+
assert!(array_match([1, 2, 3, 4]));
13+
assert!(!array_match([1, 2, 3, 5]));
14+
assert!(!array_match([0, 0, 0, 0]));
15+
assert!(!array_match([4, 3, 2, 1]));
16+
}

0 commit comments

Comments
 (0)