diff options
author | Bernardo <[email protected]> | 2019-01-07 20:35:18 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-26 08:46:16 +0000 |
commit | 6b86f038d61752bbf306ed5dd9def74be3b5dcc1 (patch) | |
tree | 680b88d8c05f0d15e46c6d3042c3d28c154e8d42 /crates/ra_vfs/tests | |
parent | d032a1a4e8c52f4ea38d9ca24070203a35436158 (diff) |
refator to move all io to io module
use same channel for scanner and watcher
some implementations pending
Diffstat (limited to 'crates/ra_vfs/tests')
-rw-r--r-- | crates/ra_vfs/tests/vfs.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_vfs/tests/vfs.rs b/crates/ra_vfs/tests/vfs.rs index 8634be9c4..21d5633b1 100644 --- a/crates/ra_vfs/tests/vfs.rs +++ b/crates/ra_vfs/tests/vfs.rs | |||
@@ -59,15 +59,15 @@ fn test_vfs_works() -> std::io::Result<()> { | |||
59 | 59 | ||
60 | // on disk change | 60 | // on disk change |
61 | fs::write(&dir.path().join("a/b/baz.rs"), "quux").unwrap(); | 61 | fs::write(&dir.path().join("a/b/baz.rs"), "quux").unwrap(); |
62 | let change = vfs.change_receiver().recv().unwrap(); | 62 | let task = vfs.task_receiver().recv().unwrap(); |
63 | vfs.handle_change(change); | 63 | vfs.handle_task(task); |
64 | match vfs.commit_changes().as_slice() { | 64 | match vfs.commit_changes().as_slice() { |
65 | [VfsChange::ChangeFile { text, .. }] => assert_eq!(text.as_str(), "quux"), | 65 | [VfsChange::ChangeFile { text, .. }] => assert_eq!(text.as_str(), "quux"), |
66 | _ => panic!("unexpected changes"), | 66 | _ => panic!("unexpected changes"), |
67 | } | 67 | } |
68 | 68 | ||
69 | // in memory change | 69 | // in memory change |
70 | vfs.change_file_overlay(&dir.path().join("a/b/baz.rs"), Some("m".to_string())); | 70 | vfs.change_file_overlay(&dir.path().join("a/b/baz.rs"), "m".to_string()); |
71 | match vfs.commit_changes().as_slice() { | 71 | match vfs.commit_changes().as_slice() { |
72 | [VfsChange::ChangeFile { text, .. }] => assert_eq!(text.as_str(), "m"), | 72 | [VfsChange::ChangeFile { text, .. }] => assert_eq!(text.as_str(), "m"), |
73 | _ => panic!("unexpected changes"), | 73 | _ => panic!("unexpected changes"), |
@@ -81,7 +81,7 @@ fn test_vfs_works() -> std::io::Result<()> { | |||
81 | } | 81 | } |
82 | 82 | ||
83 | // in memory add | 83 | // in memory add |
84 | vfs.add_file_overlay(&dir.path().join("a/b/spam.rs"), Some("spam".to_string())); | 84 | vfs.add_file_overlay(&dir.path().join("a/b/spam.rs"), "spam".to_string()); |
85 | match vfs.commit_changes().as_slice() { | 85 | match vfs.commit_changes().as_slice() { |
86 | [VfsChange::AddFile { text, path, .. }] => { | 86 | [VfsChange::AddFile { text, path, .. }] => { |
87 | assert_eq!(text.as_str(), "spam"); | 87 | assert_eq!(text.as_str(), "spam"); |
@@ -99,8 +99,8 @@ fn test_vfs_works() -> std::io::Result<()> { | |||
99 | 99 | ||
100 | // on disk add | 100 | // on disk add |
101 | fs::write(&dir.path().join("a/new.rs"), "new hello").unwrap(); | 101 | fs::write(&dir.path().join("a/new.rs"), "new hello").unwrap(); |
102 | let change = vfs.change_receiver().recv().unwrap(); | 102 | let task = vfs.task_receiver().recv().unwrap(); |
103 | vfs.handle_change(change); | 103 | vfs.handle_task(task); |
104 | match vfs.commit_changes().as_slice() { | 104 | match vfs.commit_changes().as_slice() { |
105 | [VfsChange::AddFile { text, path, .. }] => { | 105 | [VfsChange::AddFile { text, path, .. }] => { |
106 | assert_eq!(text.as_str(), "new hello"); | 106 | assert_eq!(text.as_str(), "new hello"); |
@@ -111,8 +111,8 @@ fn test_vfs_works() -> std::io::Result<()> { | |||
111 | 111 | ||
112 | // on disk rename | 112 | // on disk rename |
113 | fs::rename(&dir.path().join("a/new.rs"), &dir.path().join("a/new1.rs")).unwrap(); | 113 | fs::rename(&dir.path().join("a/new.rs"), &dir.path().join("a/new1.rs")).unwrap(); |
114 | let change = vfs.change_receiver().recv().unwrap(); | 114 | let task = vfs.task_receiver().recv().unwrap(); |
115 | vfs.handle_change(change); | 115 | vfs.handle_task(task); |
116 | match vfs.commit_changes().as_slice() { | 116 | match vfs.commit_changes().as_slice() { |
117 | [VfsChange::RemoveFile { | 117 | [VfsChange::RemoveFile { |
118 | path: removed_path, .. | 118 | path: removed_path, .. |
@@ -130,14 +130,14 @@ fn test_vfs_works() -> std::io::Result<()> { | |||
130 | 130 | ||
131 | // on disk remove | 131 | // on disk remove |
132 | fs::remove_file(&dir.path().join("a/new1.rs")).unwrap(); | 132 | fs::remove_file(&dir.path().join("a/new1.rs")).unwrap(); |
133 | let change = vfs.change_receiver().recv().unwrap(); | 133 | let task = vfs.task_receiver().recv().unwrap(); |
134 | vfs.handle_change(change); | 134 | vfs.handle_task(task); |
135 | match vfs.commit_changes().as_slice() { | 135 | match vfs.commit_changes().as_slice() { |
136 | [VfsChange::RemoveFile { path, .. }] => assert_eq!(path, "new1.rs"), | 136 | [VfsChange::RemoveFile { path, .. }] => assert_eq!(path, "new1.rs"), |
137 | _ => panic!("unexpected changes"), | 137 | _ => panic!("unexpected changes"), |
138 | } | 138 | } |
139 | 139 | ||
140 | match vfs.change_receiver().try_recv() { | 140 | match vfs.task_receiver().try_recv() { |
141 | Err(crossbeam_channel::TryRecvError::Empty) => (), | 141 | Err(crossbeam_channel::TryRecvError::Empty) => (), |
142 | res => panic!("unexpected {:?}", res), | 142 | res => panic!("unexpected {:?}", res), |
143 | } | 143 | } |