Skip to content

Commit 81871d0

Browse files
committed
tests: Add test for pattern matching
See-Also: rust-ux#66
1 parent c1f82d9 commit 81871d0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -953,4 +953,17 @@ mod tests {
953953
assert_eq!(!u7(0), u7(0x7F));
954954
assert_eq!(!u7(56), u7(71));
955955
}
956+
957+
#[test]
958+
fn test_match() {
959+
const SEVEN: u7 = u7::new(7);
960+
match u7(7) {
961+
SEVEN => (),
962+
_ => panic!("Pattern matching failed (7 != 7?)"),
963+
}
964+
match u7(42) {
965+
SEVEN => panic!("Pattern matching failed (7 == 42?)"),
966+
_ => (),
967+
}
968+
}
956969
}

0 commit comments

Comments
 (0)