Store hashes in special types so they aren't accidentally encoded as numbers
This commit is contained in:
parent
de96f3d873
commit
0445fbdd83
38 changed files with 274 additions and 138 deletions
|
@ -3,8 +3,12 @@ use super::*;
|
|||
#[test]
|
||||
fn test_lookup_line() {
|
||||
let source = "abcdefghijklm\nabcdefghij\n...".to_owned();
|
||||
let sf =
|
||||
SourceFile::new(FileName::Anon(0), source, BytePos(3), SourceFileHashAlgorithm::Sha256);
|
||||
let sf = SourceFile::new(
|
||||
FileName::Anon(Hash64::ZERO),
|
||||
source,
|
||||
BytePos(3),
|
||||
SourceFileHashAlgorithm::Sha256,
|
||||
);
|
||||
sf.lines(|lines| assert_eq!(lines, &[BytePos(3), BytePos(17), BytePos(28)]));
|
||||
|
||||
assert_eq!(sf.lookup_line(BytePos(0)), None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue