diff options
author | Aleksey Kladov <[email protected]> | 2018-09-05 15:03:27 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-05 15:03:27 +0100 |
commit | 649f7faf7d6eb25635dd624a2ea50a47ac090e09 (patch) | |
tree | c1d75c6565f3cfc97e910b5f1a1ff9c11a2b8a67 /crates/libanalysis/tests | |
parent | f87771092c5df9e9c07bcb5052e662bde0a0fa59 (diff) |
fix tests on windows
Diffstat (limited to 'crates/libanalysis/tests')
-rw-r--r-- | crates/libanalysis/tests/tests.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/libanalysis/tests/tests.rs b/crates/libanalysis/tests/tests.rs index 4fae7c313..9d2db731b 100644 --- a/crates/libanalysis/tests/tests.rs +++ b/crates/libanalysis/tests/tests.rs | |||
@@ -28,11 +28,18 @@ impl FileResolver for FileMap { | |||
28 | self.path(id).file_stem().unwrap().to_str().unwrap().to_string() | 28 | self.path(id).file_stem().unwrap().to_str().unwrap().to_string() |
29 | } | 29 | } |
30 | fn resolve(&self, id: FileId, rel: &RelativePath) -> Option<FileId> { | 30 | fn resolve(&self, id: FileId, rel: &RelativePath) -> Option<FileId> { |
31 | let path = rel.to_path(self.path(id)); | 31 | let path = { |
32 | let path = path.to_str().unwrap(); | 32 | if rel.starts_with("..") { |
33 | let path = RelativePath::new(&path[1..]).normalize(); | 33 | rel.strip_prefix("..").unwrap() |
34 | .to_path(&self.path(id).parent().unwrap()) | ||
35 | } else { | ||
36 | rel.to_path(self.path(id)) | ||
37 | } | ||
38 | }; | ||
39 | let path = &path.to_str().unwrap()[1..]; | ||
40 | let path = RelativePath::new(&path[0..]).normalize(); | ||
34 | let &(id, _) = self.0.iter() | 41 | let &(id, _) = self.0.iter() |
35 | .find(|it| path == RelativePath::new(&it.1[1..]).normalize())?; | 42 | .find(|it| path == RelativePath::new(&it.1[0..]).normalize())?; |
36 | Some(FileId(id)) | 43 | Some(FileId(id)) |
37 | } | 44 | } |
38 | } | 45 | } |