rust-clippy/tests/matches.rs
Oliver Schneider 7b717d3152
fallout
2016-08-17 18:35:25 +02:00

24 lines
729 B
Rust

#![feature(rustc_private)]
extern crate clippy_lints;
extern crate syntax;
#[test]
fn test_overlapping() {
use clippy_lints::matches::overlapping;
use syntax::codemap::DUMMY_SP;
let sp = |s, e| {
clippy_lints::matches::SpannedRange {
span: DUMMY_SP,
node: (s, e),
}
};
assert_eq!(None, overlapping::<u8>(&[]));
assert_eq!(None, overlapping(&[sp(1, 4)]));
assert_eq!(None, overlapping(&[sp(1, 4), sp(5, 6)]));
assert_eq!(None, overlapping(&[sp(1, 4), sp(5, 6), sp(10, 11)]));
assert_eq!(Some((&sp(1, 4), &sp(3, 6))), overlapping(&[sp(1, 4), sp(3, 6)]));
assert_eq!(Some((&sp(5, 6), &sp(6, 11))), overlapping(&[sp(1, 4), sp(5, 6), sp(6, 11)]));
}