From 07a4b9f1a0c36c6bff4b0dbaaeaa93baea8b1f0e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 15:41:52 +0300 Subject: dont overwrite memfies --- crates/ra_vfs/tests/vfs.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ra_vfs/tests/vfs.rs') diff --git a/crates/ra_vfs/tests/vfs.rs b/crates/ra_vfs/tests/vfs.rs index 357e1c775..545e1dbdd 100644 --- a/crates/ra_vfs/tests/vfs.rs +++ b/crates/ra_vfs/tests/vfs.rs @@ -165,6 +165,18 @@ fn test_vfs_works() -> std::io::Result<()> { assert_eq!(path, "sub1/sub2/new1.rs") ); + { + vfs.add_file_overlay(&dir.path().join("a/memfile.rs"), "memfile".to_string()); + assert_match!( + vfs.commit_changes().as_slice(), + [VfsChange::AddFile { text, .. }], + assert_eq!(text.as_str(), "memfile") + ); + fs::write(&dir.path().join("a/memfile.rs"), "ignore me").unwrap(); + process_tasks(&mut vfs, 1); + assert_match!(vfs.commit_changes().as_slice(), []); + } + // should be ignored fs::create_dir_all(dir.path().join("a/target")).unwrap(); fs::write(&dir.path().join("a/target/new.rs"), "ignore me").unwrap(); -- cgit v1.2.3