aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/transaction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src/transaction.rs')
-rw-r--r--helix-core/src/transaction.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs
index e20e550f..d682f058 100644
--- a/helix-core/src/transaction.rs
+++ b/helix-core/src/transaction.rs
@@ -125,7 +125,7 @@ impl ChangeSet {
/// In other words, If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the
/// returned value will represent the change `docA` → `docC`.
pub fn compose(self, other: Self) -> Self {
- debug_assert!(self.len_after == other.len);
+ assert!(self.len_after == other.len);
// composing fails in weird ways if one of the sets is empty
// a: [] len: 0 len_after: 1 | b: [Insert(Tendril<UTF8>(inline: "\n")), Retain(1)] len 1
@@ -689,21 +689,21 @@ mod test {
#[test]
fn transaction_change() {
- let mut state = State::new("hello world!\ntest 123".into());
+ let mut doc = Rope::from("hello world!\ntest 123");
let transaction = Transaction::change(
- &state.doc,
+ &doc,
// (1, 1, None) is a useless 0-width delete
vec![(1, 1, None), (6, 11, Some("void".into())), (12, 17, None)].into_iter(),
);
- transaction.apply(&mut state.doc);
- assert_eq!(state.doc, Rope::from_str("hello void! 123"));
+ transaction.apply(&mut doc);
+ assert_eq!(doc, Rope::from_str("hello void! 123"));
}
#[test]
fn changes_iter() {
- let state = State::new("hello world!\ntest 123".into());
+ let doc = Rope::from("hello world!\ntest 123");
let changes = vec![(6, 11, Some("void".into())), (12, 17, None)];
- let transaction = Transaction::change(&state.doc, changes.clone().into_iter());
+ let transaction = Transaction::change(&doc, changes.clone().into_iter());
assert_eq!(transaction.changes_iter().collect::<Vec<_>>(), changes);
}