Ensure FoldMap always contains at least one transform

Previously, when splicing an edit that deleted all transforms, we would
leave the `FoldMap` empty, thus violating a bunch of downstream
invariants and e.g. causing the `BufferRows` iterator to not return any
buffer row.

This commit ensures we always have at least one transform (an isomorphic
one, specifically) and adds additional test coverage for the
`FoldMap::buffer_rows` method by adding it to the randomized tests.
This commit is contained in:
Antonio Scandurra
2021-03-29 10:18:28 +02:00
parent a949959a42
commit a88b63d83c
2 changed files with 40 additions and 2 deletions
-1
View File
@@ -102,7 +102,6 @@ impl<T: Item> SumTree<T> {
}
}
#[cfg(test)]
pub fn is_empty(&self) -> bool {
match self.0.as_ref() {
Node::Internal { .. } => false,