Line range edge cases test

This commit is contained in:
Bojan Durdevic 2021-10-25 21:55:22 -04:00 committed by David Peter
parent 715b0d8bf5
commit b8e79a2160

View file

@ -145,6 +145,19 @@ fn test_parse_minus_success() {
assert_eq!(40, range.upper);
}
#[test]
fn test_parse_minus_edge_cases_success() {
let range = LineRange::from("5:-4").expect("Shouldn't fail on test!");
assert_eq!(1, range.lower);
assert_eq!(5, range.upper);
let range = LineRange::from("5:-5").expect("Shouldn't fail on test!");
assert_eq!(0, range.lower);
assert_eq!(5, range.upper);
let range = LineRange::from("5:-100").expect("Shouldn't fail on test!");
assert_eq!(0, range.lower);
assert_eq!(5, range.upper);
}
#[test]
fn test_parse_minus_fail() {
let range = LineRange::from("40:-z");