mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-10 05:37:29 +03:00
Use fake file system for buffer identity test
This commit is contained in:
parent
f28cc5ca0c
commit
37a0fd33c5
@ -2261,14 +2261,22 @@ async fn test_rescan_and_remote_updates(
|
||||
}
|
||||
|
||||
#[gpui::test(iterations = 10)]
|
||||
async fn test_buffer_identity_across_renames(cx: &mut gpui::TestAppContext) {
|
||||
let dir = temp_tree(json!({
|
||||
"a": {
|
||||
"file1": "",
|
||||
}
|
||||
}));
|
||||
async fn test_buffer_identity_across_renames(
|
||||
deterministic: Arc<Deterministic>,
|
||||
cx: &mut gpui::TestAppContext,
|
||||
) {
|
||||
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_id = tree.read_with(cx, |tree, _| tree.id());
|
||||
|
||||
@ -2297,7 +2305,7 @@ async fn test_buffer_identity_across_renames(cx: &mut gpui::TestAppContext) {
|
||||
.unwrap()
|
||||
.await
|
||||
.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/file1", cx), file_id);
|
||||
buffer.read_with(cx, |buffer, _| assert!(!buffer.is_dirty()));
|
||||
|
Loading…
Reference in New Issue
Block a user