Skip to content

Commit 30503a9

Browse files
committed
Move matches test in matches module
1 parent 045722a commit 30503a9

File tree

2 files changed

+37
-42
lines changed

2 files changed

+37
-42
lines changed

clippy_lints/src/matches.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,3 +1197,40 @@ where
11971197

11981198
None
11991199
}
1200+
1201+
#[test]
1202+
fn test_overlapping() {
1203+
use rustc_span::source_map::DUMMY_SP;
1204+
1205+
let sp = |s, e| SpannedRange {
1206+
span: DUMMY_SP,
1207+
node: (s, e),
1208+
};
1209+
1210+
assert_eq!(None, overlapping::<u8>(&[]));
1211+
assert_eq!(None, overlapping(&[sp(1, Bound::Included(4))]));
1212+
assert_eq!(
1213+
None,
1214+
overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
1215+
);
1216+
assert_eq!(
1217+
None,
1218+
overlapping(&[
1219+
sp(1, Bound::Included(4)),
1220+
sp(5, Bound::Included(6)),
1221+
sp(10, Bound::Included(11))
1222+
],)
1223+
);
1224+
assert_eq!(
1225+
Some((&sp(1, Bound::Included(4)), &sp(3, Bound::Included(6)))),
1226+
overlapping(&[sp(1, Bound::Included(4)), sp(3, Bound::Included(6))])
1227+
);
1228+
assert_eq!(
1229+
Some((&sp(5, Bound::Included(6)), &sp(6, Bound::Included(11)))),
1230+
overlapping(&[
1231+
sp(1, Bound::Included(4)),
1232+
sp(5, Bound::Included(6)),
1233+
sp(6, Bound::Included(11))
1234+
],)
1235+
);
1236+
}

tests/matches.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)