aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/tests
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-21 16:30:10 +0100
committerAleksey Kladov <[email protected]>2018-08-21 16:30:10 +0100
commitb937262c9b75a361b95a6a27260a71c737e035bf (patch)
tree1838794f32d43a8c45c478b9f24bd74d257edd43 /crates/libanalysis/tests
parent4d8be265849c55912467961e09af657176472dcb (diff)
Module map implementation
Diffstat (limited to 'crates/libanalysis/tests')
-rw-r--r--crates/libanalysis/tests/tests.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/libanalysis/tests/tests.rs b/crates/libanalysis/tests/tests.rs
index 9ef5200af..931ab4183 100644
--- a/crates/libanalysis/tests/tests.rs
+++ b/crates/libanalysis/tests/tests.rs
@@ -43,3 +43,24 @@ fn test_resolve_module() {
43 &symbols, 43 &symbols,
44 ); 44 );
45} 45}
46
47#[test]
48fn test_resolve_parent_module() {
49 let mut world = WorldState::new();
50 world.change_file(FileId(1), Some("mod foo;".to_string()));
51 world.change_file(FileId(2), Some("".to_string()));
52
53 let snap = world.snapshot(|id, path| {
54 assert_eq!(id, FileId(1));
55 if path == PathBuf::from("../foo/mod.rs") {
56 return None;
57 }
58 assert_eq!(path, PathBuf::from("../foo.rs"));
59 Some(FileId(2))
60 });
61 let symbols = snap.parent_module(FileId(2));
62 assert_eq_dbg(
63 r#"[(FileId(1), FileSymbol { name: "foo", node_range: [0; 8), kind: MODULE })]"#,
64 &symbols,
65 );
66}