|
|
|
|
@ -11,7 +11,7 @@ use pretty_assertions::assert_eq;
|
|
|
|
|
#[derive(Debug, PartialEq, Clone, Copy)]
|
|
|
|
|
pub struct AbsoluteRange {
|
|
|
|
|
pub start: usize, // inclusive
|
|
|
|
|
pub end: usize, // exclusive
|
|
|
|
|
pub end: usize, // exclusive
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
|
@ -146,7 +146,13 @@ impl NewlinePositions {
|
|
|
|
|
fn from_offset_newline_boundary() {
|
|
|
|
|
let newline_positions = NewlinePositions::from("abc\nbar");
|
|
|
|
|
let position = newline_positions.from_offset(4);
|
|
|
|
|
assert_eq!(position, LinePosition { line: LineNumber::from(1), column: 0});
|
|
|
|
|
assert_eq!(
|
|
|
|
|
position,
|
|
|
|
|
LinePosition {
|
|
|
|
|
line: LineNumber::from(1),
|
|
|
|
|
column: 0
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|