From 0be897d5acd7c4cf5afb60a44caa3c473093cc25 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 4 Dec 2021 07:19:30 -0700 Subject: [PATCH] WIP: Edit one of the excerpted buffers and add an assertion We'll need to detect edits on the child buffers and understand their impact on the tree. --- crates/language/src/fragment_list.rs | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/crates/language/src/fragment_list.rs b/crates/language/src/fragment_list.rs index deef5570a9..725e628a1d 100644 --- a/crates/language/src/fragment_list.rs +++ b/crates/language/src/fragment_list.rs @@ -286,6 +286,35 @@ mod tests { "\n", // "jj" // ) - ) + ); + + buffer_1.update(cx, |buffer, cx| { + buffer.edit( + [ + Point::new(0, 0)..Point::new(0, 0), + Point::new(2, 1)..Point::new(2, 2), + ], + "\n", + cx, + ); + }); + + assert_eq!( + list.read(cx).text(), + concat!( + "\n", // Preserve newlines + "\n", // + "bbbb\n", // + "c\n", // + "ccc\n", // + "\n", // + "ddd\n", // + "eeee\n", // + "\n", // + "\n", // + "\n", // + "jj" // + ) + ); } }