Skip to content

Commit fecc6da

Browse files
committed
Fix existing tests.
1 parent 642cf9c commit fecc6da

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/testsuite/dep_info.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ fn assert_deps(project: &Project, fingerprint: &str, test_cb: impl Fn(&Path, &[(
2626
let dep_info = &mut &dep_info[..];
2727
let deps = (0..read_usize(dep_info))
2828
.map(|_| {
29+
//FIXME rather than discarding these we could check them?
30+
read_u64(dep_info); //filesize
31+
str::from_utf8(read_bytes(dep_info)).unwrap(); //hash
32+
read_u8(dep_info); //hashkind
2933
(
3034
read_u8(dep_info),
3135
str::from_utf8(read_bytes(dep_info)).unwrap(),
@@ -49,6 +53,21 @@ fn assert_deps(project: &Project, fingerprint: &str, test_cb: impl Fn(&Path, &[(
4953
ret
5054
}
5155

56+
fn read_u64(bytes: &mut &[u8]) -> Option<u64> {
57+
let ret = bytes.get(..8)?;
58+
*bytes = &bytes[8..];
59+
Some(
60+
((ret[0] as u64) << 0)
61+
| ((ret[1] as u64) << 8)
62+
| ((ret[2] as u64) << 16)
63+
| ((ret[3] as u64) << 24)
64+
| ((ret[4] as u64) << 32)
65+
| ((ret[5] as u64) << 40)
66+
| ((ret[6] as u64) << 48)
67+
| ((ret[7] as u64) << 56),
68+
)
69+
}
70+
5271
fn read_bytes<'a>(bytes: &mut &'a [u8]) -> &'a [u8] {
5372
let n = read_usize(bytes) as usize;
5473
let ret = &bytes[..n];

0 commit comments

Comments
 (0)