External spans: fixed unit tests and addressed review.
This commit is contained in:
parent
634cd2ce73
commit
afe841587d
2 changed files with 5 additions and 4 deletions
|
|
@ -81,7 +81,7 @@ impl StableHasherResult for [u8; 20] {
|
|||
impl StableHasherResult for u128 {
|
||||
fn finish(mut hasher: StableHasher<Self>) -> Self {
|
||||
let hash_bytes: &[u8] = hasher.finalize();
|
||||
assert!(hash_bytes.len() >= mem::size_of::<u64>() * 2);
|
||||
assert!(hash_bytes.len() >= mem::size_of::<u128>());
|
||||
|
||||
unsafe {
|
||||
::std::ptr::read_unaligned(hash_bytes.as_ptr() as *const u128)
|
||||
|
|
|
|||
|
|
@ -618,6 +618,7 @@ impl FilePathMapping {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::borrow::Cow;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[test]
|
||||
|
|
@ -627,12 +628,12 @@ mod tests {
|
|||
"first line.\nsecond line".to_string());
|
||||
fm.next_line(BytePos(0));
|
||||
// Test we can get lines with partial line info.
|
||||
assert_eq!(fm.get_line(0), Some("first line."));
|
||||
assert_eq!(fm.get_line(0), Some(Cow::from("first line.")));
|
||||
// TESTING BROKEN BEHAVIOR: line break declared before actual line break.
|
||||
fm.next_line(BytePos(10));
|
||||
assert_eq!(fm.get_line(1), Some("."));
|
||||
assert_eq!(fm.get_line(1), Some(Cow::from(".")));
|
||||
fm.next_line(BytePos(12));
|
||||
assert_eq!(fm.get_line(2), Some("second line"));
|
||||
assert_eq!(fm.get_line(2), Some(Cow::from("second line")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue