mirror of
https://github.com/sharkdp/bat
synced 2024-12-03 17:19:27 +00:00
Line range edge cases test
This commit is contained in:
parent
715b0d8bf5
commit
b8e79a2160
1 changed files with 13 additions and 0 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue