Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: conflict check when reference right is none #40

Merged
merged 2 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }

[unstable]
gc = true
5 changes: 5 additions & 0 deletions y-octo/src/doc/codec/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ mod tests {
(include_bytes!("../../fixtures/database.bin").to_vec(), 1, 149),
(include_bytes!("../../fixtures/large.bin").to_vec(), 1, 9036),
(include_bytes!("../../fixtures/with-subdoc.bin").to_vec(), 2, 30),
(
include_bytes!("../../fixtures/edge-case-left-right-same-node.bin").to_vec(),
2,
243,
),
];

for (doc, clients, structs) in docs {
Expand Down
17 changes: 17 additions & 0 deletions y-octo/src/doc/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,21 @@ mod tests {
assert_eq!(&text.to_string(), "hello world");
});
}

#[test]
#[cfg_attr(any(miri, loom), ignore)]
fn test_apply_update() {
let updates = [
include_bytes!("../fixtures/basic.bin").to_vec(),
include_bytes!("../fixtures/database.bin").to_vec(),
include_bytes!("../fixtures/large.bin").to_vec(),
include_bytes!("../fixtures/with-subdoc.bin").to_vec(),
include_bytes!("../fixtures/edge-case-left-right-same-node.bin").to_vec(),
];

for update in updates {
let mut doc = Doc::new();
doc.apply_update_from_binary_v1(&update).unwrap();
}
}
}
2 changes: 1 addition & 1 deletion y-octo/src/doc/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ impl DocStore {
let mut right = right.get_mut_unchecked();
right.left = item_owner_ref.clone();
}
this.right = right.clone();
} else {
// no right, parent.start = this, delete this.left
if let Some(parent_sub) = &this.parent_sub {
Expand All @@ -565,6 +564,7 @@ impl DocStore {
}
}
}
this.right = right.clone();

let parent_deleted = parent.item.get().map(|item| item.deleted()).unwrap_or(false);

Expand Down
Binary file not shown.
Loading