Use fake file system for buffer identity test
This commit is contained in:
parent
f28cc5ca0c
commit
37a0fd33c5
1 changed files with 16 additions and 8 deletions
|
@ -2261,14 +2261,22 @@ async fn test_rescan_and_remote_updates(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test(iterations = 10)]
|
#[gpui::test(iterations = 10)]
|
||||||
async fn test_buffer_identity_across_renames(cx: &mut gpui::TestAppContext) {
|
async fn test_buffer_identity_across_renames(
|
||||||
let dir = temp_tree(json!({
|
deterministic: Arc<Deterministic>,
|
||||||
"a": {
|
cx: &mut gpui::TestAppContext,
|
||||||
"file1": "",
|
) {
|
||||||
}
|
let fs = FakeFs::new(cx.background());
|
||||||
}));
|
fs.insert_tree(
|
||||||
|
"/dir",
|
||||||
|
json!({
|
||||||
|
"a": {
|
||||||
|
"file1": "",
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
let project = Project::test(Arc::new(RealFs), [dir.path()], cx).await;
|
let project = Project::test(fs, [Path::new("/dir")], cx).await;
|
||||||
let tree = project.read_with(cx, |project, cx| project.worktrees(cx).next().unwrap());
|
let tree = project.read_with(cx, |project, cx| project.worktrees(cx).next().unwrap());
|
||||||
let tree_id = tree.read_with(cx, |tree, _| tree.id());
|
let tree_id = tree.read_with(cx, |tree, _| tree.id());
|
||||||
|
|
||||||
|
@ -2297,7 +2305,7 @@ async fn test_buffer_identity_across_renames(cx: &mut gpui::TestAppContext) {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tree.flush_fs_events(cx).await;
|
deterministic.run_until_parked();
|
||||||
assert_eq!(id_for_path("b", cx), dir_id);
|
assert_eq!(id_for_path("b", cx), dir_id);
|
||||||
assert_eq!(id_for_path("b/file1", cx), file_id);
|
assert_eq!(id_for_path("b/file1", cx), file_id);
|
||||||
buffer.read_with(cx, |buffer, _| assert!(!buffer.is_dirty()));
|
buffer.read_with(cx, |buffer, _| assert!(!buffer.is_dirty()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue