Skip to content

Commit

Permalink
tests: Add test for pattern matching
Browse files Browse the repository at this point in the history
See-Also: #66
  • Loading branch information
chrysn committed May 30, 2024
1 parent c1f82d9 commit 81871d0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,4 +953,17 @@ mod tests {
assert_eq!(!u7(0), u7(0x7F));
assert_eq!(!u7(56), u7(71));
}

#[test]
fn test_match() {
const SEVEN: u7 = u7::new(7);
match u7(7) {
SEVEN => (),
_ => panic!("Pattern matching failed (7 != 7?)"),
}
match u7(42) {
SEVEN => panic!("Pattern matching failed (7 == 42?)"),
_ => (),
}
}
}

0 comments on commit 81871d0

Please sign in to comment.