Remove the exponential API
This commit is contained in:
parent
0448e30dd9
commit
4fda83fe17
8 changed files with 248 additions and 150 deletions
|
|
@ -1,18 +1,18 @@
|
|||
#![cfg(feature = "wasm")]
|
||||
|
||||
use reconcile::{CursorPosition, TextWithCursors, wasm::*};
|
||||
use reconcile::{BuiltinTokenizer, CursorPosition, TextWithCursors, wasm::*};
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
#[wasm_bindgen_test(unsupported = test)]
|
||||
fn test_merge() {
|
||||
let left = b"hello ";
|
||||
let right = b"world";
|
||||
let result = merge(b"", left, right);
|
||||
let result = generic_reconcile(b"", left, right, BuiltinTokenizer::Word);
|
||||
assert_eq!(result, b"hello world");
|
||||
|
||||
let left = b"\0binary";
|
||||
let right = b"other";
|
||||
let result = merge(b"", left, right);
|
||||
let result = generic_reconcile(b"", left, right, BuiltinTokenizer::Word);
|
||||
assert_eq!(result, right);
|
||||
}
|
||||
|
||||
|
|
@ -20,19 +20,20 @@ fn test_merge() {
|
|||
fn test_merge_text() {
|
||||
let left = "hello ";
|
||||
let right = "world";
|
||||
let result = merge_text("", left, right);
|
||||
let result = reconcile("", &left.into(), &right.into(), BuiltinTokenizer::Word).text();
|
||||
assert_eq!(result, "hello world");
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test(unsupported = test)]
|
||||
fn test_merge_text_with_cursors() {
|
||||
let result = merge_text_with_cursors(
|
||||
let result = reconcile(
|
||||
"hi",
|
||||
&TextWithCursors::new("hi world".to_owned(), vec![]),
|
||||
&TextWithCursors::new(
|
||||
"hi".to_owned(),
|
||||
vec![CursorPosition::new(0, 1), CursorPosition::new(1, 2)],
|
||||
),
|
||||
BuiltinTokenizer::Word,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
|
@ -48,7 +49,10 @@ fn test_merge_text_with_cursors() {
|
|||
fn merge_binary() {
|
||||
let left = [0, 1, 2];
|
||||
let right = [3, 4, 5];
|
||||
assert_eq!(merge(b"", &left, &right), right);
|
||||
assert_eq!(
|
||||
generic_reconcile(b"", &left, &right, BuiltinTokenizer::Word),
|
||||
right
|
||||
);
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test(unsupported = test)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue