refactor: remove unused review state and duplicate storage reads
This commit is contained in:
@@ -2910,17 +2910,6 @@ fn sqlite_reviews_autosave_restore_select_and_keep_exports_independent() {
|
||||
let mut choosing = editor();
|
||||
choosing.set_review_directory(storage);
|
||||
historical_diff(&mut choosing, &root, vec!["old".into()], vec!["new".into()]);
|
||||
assert_eq!(
|
||||
choosing
|
||||
.workspace_diff()
|
||||
.unwrap()
|
||||
.local_review
|
||||
.choices
|
||||
.iter()
|
||||
.map(|(id, _)| *id)
|
||||
.collect::<std::collections::BTreeSet<_>>(),
|
||||
std::collections::BTreeSet::from([id, second_id])
|
||||
);
|
||||
choosing.handle(Input::Enter);
|
||||
assert_eq!(
|
||||
choosing
|
||||
|
||||
+12
-16
@@ -46,20 +46,21 @@ fn database_restarts_preserve_identity_and_exact_stale_anchors() {
|
||||
}
|
||||
let mut store = Store::open(&storage).unwrap();
|
||||
let id = review.storage_id.unwrap();
|
||||
assert_eq!(
|
||||
store.list(&root).unwrap(),
|
||||
vec![(id, "Unicode review".into())]
|
||||
);
|
||||
let listed = store.list(&root).unwrap();
|
||||
assert_eq!(listed[0].storage_id, Some(id));
|
||||
assert_eq!(listed[0].summary, review.summary);
|
||||
assert_eq!(listed[0].comments, review.comments);
|
||||
let mut loaded = store.load(&root, id).unwrap();
|
||||
assert_eq!(loaded.storage_id, Some(id));
|
||||
assert_eq!(loaded.storage_revision, 1);
|
||||
assert_eq!(loaded.comments, review.comments);
|
||||
assert_eq!(loaded.verdict, review.verdict);
|
||||
assert!(!loaded.comments[0].anchor.matches(
|
||||
assert!(!loaded.comments[0].anchor.matches_lines(
|
||||
"working:new-snapshot",
|
||||
Path::new("日本語.rs"),
|
||||
Side::Before,
|
||||
"changed\n",
|
||||
&["changed".into()],
|
||||
true,
|
||||
));
|
||||
let path = root.join("export.json");
|
||||
loaded.save(&path).unwrap();
|
||||
@@ -107,8 +108,8 @@ fn database_repository_identity_is_canonical_and_independent() {
|
||||
let alias = first_root.join("alias");
|
||||
std::os::unix::fs::symlink(&first_root, &alias).unwrap();
|
||||
assert_eq!(
|
||||
store.list(&alias).unwrap(),
|
||||
store.list(&first_root).unwrap()
|
||||
store.list(&alias).unwrap()[0].storage_id,
|
||||
store.list(&first_root).unwrap()[0].storage_id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -324,17 +325,12 @@ fn persistence_validates_anchors_and_preserves_files_on_failure() {
|
||||
assert_eq!(loaded.comments, review.comments);
|
||||
assert_eq!(loaded.verdict, review.verdict);
|
||||
let anchor = &loaded.comments[0].anchor;
|
||||
assert!(anchor.matches(
|
||||
"working:immutable",
|
||||
Path::new("source.rs"),
|
||||
Side::After,
|
||||
"first\nlast\n"
|
||||
));
|
||||
assert!(!anchor.matches(
|
||||
assert!(!anchor.matches_lines(
|
||||
"working:other",
|
||||
Path::new("source.rs"),
|
||||
Side::After,
|
||||
"first\nlast\n"
|
||||
&["first".into(), "last".into()],
|
||||
true
|
||||
));
|
||||
assert!(anchor.matches_lines(
|
||||
"working:immutable",
|
||||
|
||||
Reference in New Issue
Block a user