Fix build and add another test
This commit is contained in:
parent
8e068c2599
commit
67cec1ec4b
3 changed files with 18 additions and 2 deletions
|
@ -21,6 +21,11 @@ pub struct OpSeqPair(OpSeq, OpSeq);
|
|||
|
||||
#[wasm_bindgen]
|
||||
impl OpSeq {
|
||||
/// Creates a default empty `OpSeq`.
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Creates a store for operatations which does not need to allocate until
|
||||
/// `capacity` operations have been stored inside.
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
|
|
|
@ -40,3 +40,13 @@ fn transform_operations() {
|
|||
assert_eq!(ab_prime, ba_prime);
|
||||
assert_eq!(after_ab_prime, after_ba_prime);
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn invert_operations() {
|
||||
let s = "abc";
|
||||
let mut o = OpSeq::default();
|
||||
o.retain(3);
|
||||
o.insert("def");
|
||||
let p = o.invert(s);
|
||||
assert_eq!(p.apply(&o.apply(s).unwrap()).unwrap(), s);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { duplicate } from "rustpad-core";
|
||||
import { set_panic_hook } from "rustpad-core";
|
||||
|
||||
function App() {
|
||||
const [input, setInput] = useState("");
|
||||
|
@ -7,7 +7,8 @@ function App() {
|
|||
const [messages, setMessages] = useState<[number, string][]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(duplicate("Hello"));
|
||||
set_panic_hook();
|
||||
|
||||
const uri =
|
||||
(window.location.origin.startsWith("https") ? "wss://" : "ws://") +
|
||||
window.location.host +
|
||||
|
|
Loading…
Add table
Reference in a new issue