1
Fork 0

Register the file while computing its start position.

This commit is contained in:
Camille GILLOT 2023-09-03 12:45:23 +00:00
parent 258ace613d
commit 548ba13265
5 changed files with 44 additions and 46 deletions

View file

@ -4,7 +4,8 @@ use super::*;
fn test_lookup_line() {
let source = "abcdefghijklm\nabcdefghij\n...".to_owned();
let mut sf =
SourceFile::new(FileName::Anon(Hash64::ZERO), source, SourceFileHashAlgorithm::Sha256);
SourceFile::new(FileName::Anon(Hash64::ZERO), source, SourceFileHashAlgorithm::Sha256)
.unwrap();
sf.start_pos = BytePos(3);
sf.lines(|lines| {
assert_eq!(lines, &[RelativeBytePos(0), RelativeBytePos(14), RelativeBytePos(25)])