mirror of
https://github.com/loro-dev/loro.git
synced 2025-02-06 12:25:03 +00:00
chore: add assert
This commit is contained in:
parent
00dbf0622d
commit
5bcaf4c58a
2 changed files with 7 additions and 5 deletions
|
@ -75,7 +75,8 @@ impl Rope {
|
|||
match node {
|
||||
Node::Internal(internal_node) => {
|
||||
if index == 0 {
|
||||
return 0
|
||||
assert_eq!(ans, 0);
|
||||
return 0;
|
||||
}
|
||||
let result = find_pos_internal(internal_node, index, &src_cache);
|
||||
if !result.found {
|
||||
|
|
|
@ -31,10 +31,11 @@ fn example_text() {
|
|||
text.insert_utf16(&doc, 0, "你好").unwrap();
|
||||
text.insert_utf16(&doc, 1, "我").unwrap();
|
||||
text.insert_utf16(&doc, 1, "abc").unwrap();
|
||||
text.insert_utf16(&doc, 2, "dd").unwrap();
|
||||
println!("text {:?}", text.get_value());
|
||||
assert_eq!(text.get_value().as_string().unwrap().as_ref(), "你abc我好");
|
||||
text.delete_utf16(&doc, 1, 1).unwrap();
|
||||
println!("text {:?}", text.get_value());
|
||||
assert_eq!(text.get_value().as_string().unwrap().as_ref(), "你bc我好");
|
||||
text.delete_utf16(&doc, 0, 1).unwrap();
|
||||
assert_eq!(text.get_value().as_string().unwrap().as_ref(), "bc我好");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue