Enhance randomized test to verify SuggestionMap::{chunks,sync}
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
4d6726ef39
commit
f44549eb29
2 changed files with 81 additions and 26 deletions
|
@ -31,7 +31,7 @@ const CHUNK_BASE: usize = 16;
|
|||
/// hash being equivalent to hashing all the text contained in the [Rope] at once.
|
||||
pub type RopeFingerprint = HashMatrix;
|
||||
|
||||
#[derive(Clone, Default, Debug)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct Rope {
|
||||
chunks: SumTree<Chunk>,
|
||||
}
|
||||
|
@ -389,6 +389,22 @@ impl fmt::Display for Rope {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Rope {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use std::fmt::Write as _;
|
||||
|
||||
write!(f, "\"")?;
|
||||
let mut format_string = String::new();
|
||||
for chunk in self.chunks() {
|
||||
write!(&mut format_string, "{:?}", chunk)?;
|
||||
write!(f, "{}", &format_string[1..format_string.len() - 1])?;
|
||||
format_string.clear();
|
||||
}
|
||||
write!(f, "\"")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Cursor<'a> {
|
||||
rope: &'a Rope,
|
||||
chunks: sum_tree::Cursor<'a, Chunk, usize>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue