@@ -45,10 +45,12 @@ impl ChangeSet {
4545 /// In other words, If `this` goes `docA` → `docB` and `other` represents `docB` → `docC`, the
4646 /// returned value will represent the change `docA` → `docC`.
4747 pub fn compose(self, other: ChangeSet) -> Result<Self, ()> {
48− if self.len != other.len {
49− // length mismatch
50− return Err(());
51− }
48+ // TODO: len before should match len after
49+
50+ // if self.len != other.len {
51+ // // length mismatch
52+ // return Err(());
53+ // }
5254
5355 let len = self.changes.len();
5456
@@ -477,23 +479,23 @@ mod test {
477479 Insert("!".into()),
478480 Retain(1),
479481 Delete(2),
480− Insert("ab".into()),
482+ Insert("abc".into()),
481483 ],
482− len: 7,
484+ len: 8,
483485 };
484486
485487 let b = ChangeSet {
486− changes: vec![Delete(5), Insert("world".into()), Retain(4)],
487− len: 7,
488+ changes: vec![Delete(5), Insert("world".into()), Retain(5)],
489+ len: 9,
488490 };
489491
490492 let mut text = Rope::from("hello xz");
491493
492494 // should probably return cloned text
493− a.compose(b).unwrap().apply(&mut text);
494−
495− // unimplemented!("{:?}", text);
496− // TODO: assert
495+ let composed = a.compose(b).unwrap();
496+ assert_eq!(composed.len, 8);
497+ assert!(composed.apply(&mut text));
498+ assert_eq!(text, "world! abc");
497499 }
498500
499501 #[test]