Fix tests

This commit is contained in:
Andras Schmelczer 2025-12-06 11:50:13 +00:00
commit 20eb81a78d
2 changed files with 9 additions and 6 deletions

View file

@ -1,8 +1,10 @@
mod diff_error;
mod edited_text;
mod operation;
mod utils;
use std::fmt::Debug;
pub use diff_error::DiffError;
pub use edited_text::EditedText;
pub use operation::Operation;

View file

@ -105,16 +105,17 @@ pub fn diff(parent: &str, changed: &TextWithCursors, tokenizer: BuiltinTokenizer
pub fn undiff(parent: &str, diff: Vec<JsValue>, tokenizer: BuiltinTokenizer) -> String {
set_panic_hook();
EditedText::from_diff(
match EditedText::from_diff(
parent,
diff.into_iter()
.map(std::convert::TryInto::try_into)
.collect::<Result<_, _>>()
.expect("Invalid diff format"),
&*tokenizer,
)
.apply()
.text()
) {
Ok(edited_text) => edited_text.apply().text(),
Err(e) => panic!("{}", e),
}
}
fn set_panic_hook() {