Skip to content

Commit

Permalink
Move matches test in matches module
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Apr 3, 2020
1 parent 045722a commit 234d407
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 42 deletions.
37 changes: 37 additions & 0 deletions clippy_lints/src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,3 +1197,40 @@ where

None
}

#[test]
fn test_overlapping() {
use rustc_span::source_map::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, Bound::Included(4))]));
assert_eq!(
None,
overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
);
assert_eq!(
None,
overlapping(&[
sp(1, Bound::Included(4)),
sp(5, Bound::Included(6)),
sp(10, Bound::Included(11))
],)
);
assert_eq!(
Some((&sp(1, Bound::Included(4)), &sp(3, Bound::Included(6)))),
overlapping(&[sp(1, Bound::Included(4)), sp(3, Bound::Included(6))])
);
assert_eq!(
Some((&sp(5, Bound::Included(6)), &sp(6, Bound::Included(11)))),
overlapping(&[
sp(1, Bound::Included(4)),
sp(5, Bound::Included(6)),
sp(6, Bound::Included(11))
],)
);
}
42 changes: 0 additions & 42 deletions tests/matches.rs

This file was deleted.

0 comments on commit 234d407

Please sign in to comment.