We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm not sure the test below is 100% minimal, but I am seeing that the old key "discard" is not removed from the converted document.
automerge = "0.5.11" autosurgeon = "0.8.3"
#[cfg(test)] mod tests { use automerge::AutoCommit; use autosurgeon::{reconcile, Hydrate, Reconcile}; pub fn debug_dump_doc<D>(doc: &D) -> String where D: automerge::ReadDoc, { serde_json::to_string_pretty(&automerge::AutoSerde::from(doc)).unwrap() } #[derive(Clone, Debug, Default, Hydrate, Reconcile)] pub struct V1Container { pub items: Vec<V1Item>, } #[derive(Clone, Debug, Default, Hydrate, Reconcile)] pub struct V1Item{ pub keep: String, pub discard: String, } #[derive(Clone, Debug, Default, Hydrate, Reconcile)] pub struct V2Container { pub items: Vec<V2Item>, } #[derive(Clone, Debug, Default, Hydrate, Reconcile)] pub struct V2Item{ pub keep: String, } pub fn convert_item(old: V1Item) -> V2Item { V2Item { keep: old.keep, } } pub fn convert_container(old: V1Container) -> V2Container { V2Container { items: old.items.into_iter().map(convert_item).collect(), } } fn make_test_v1() -> V1Container { V1Container { items: vec![ V1Item { keep: "keep".to_string(), discard: "discard".to_string(), }, V1Item { keep: "keep".to_string(), discard: "discard".to_string(), }, ], } } #[test] fn test_container_with_items() { let orig = make_test_v1(); let converted = convert_container(orig.clone()); let mut doc = AutoCommit::new(); reconcile(&mut doc, &orig).unwrap(); reconcile(&mut doc, &converted).unwrap(); let orig_dump = debug_dump_doc(&doc); let mut new_doc = AutoCommit::new(); reconcile(&mut new_doc, converted.clone()).unwrap(); let new_dump = debug_dump_doc(&new_doc); assert_eq!(orig_dump, new_dump); } }
The text was updated successfully, but these errors were encountered:
An reason not to do this in #52
Sorry, something went wrong.
No branches or pull requests
I'm not sure the test below is 100% minimal, but I am seeing that the old key "discard" is not removed from the converted document.
The text was updated successfully, but these errors were encountered: