about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-02-19 16:30:49 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2017-02-20 01:12:21 +0100
commite606a43320323e702ec8f606bbbb0a1c083eaa55 (patch)
tree1c4adb26e8085b3492d6eea2484c120d65bb7b72 /src
parent047a215b4d9cf762d3704ee02b76467897bbbe21 (diff)
downloadrust-e606a43320323e702ec8f606bbbb0a1c083eaa55.tar.gz
rust-e606a43320323e702ec8f606bbbb0a1c083eaa55.zip
Fix rustdoc test with new file path
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/runtest.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index d0aba8a0b0a..636100ef503 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1986,12 +1986,22 @@ actual:\n\
     fn check_rustdoc_test_option(&self, res: ProcRes) {
         let mut other_files = Vec::new();
         let mut files: HashMap<String, Vec<usize>> = HashMap::new();
-        files.insert(self.testpaths.file.to_str().unwrap().to_owned(),
+        let cwd = env::current_dir().unwrap();
+        files.insert(self.testpaths.file.strip_prefix(&cwd)
+                                        .unwrap_or(&self.testpaths.file)
+                                        .to_str()
+                                        .unwrap()
+                                        .replace('\\', "/"),
                      self.get_lines(&self.testpaths.file, Some(&mut other_files)));
         for other_file in other_files {
             let mut path = self.testpaths.file.clone();
             path.set_file_name(&format!("{}.rs", other_file));
-            files.insert(path.to_str().unwrap().to_owned(), self.get_lines(&path, None));
+            files.insert(path.strip_prefix(&cwd)
+                             .unwrap_or(&path)
+                             .to_str()
+                             .unwrap()
+                             .to_owned(),
+                         self.get_lines(&path, None));
         }
 
         let mut tested = 0;
@@ -2001,7 +2011,8 @@ actual:\n\
                                let tmp: Vec<&str> = s.split(" - ").collect();
                                if tmp.len() == 2 {
                                    let path = tmp[0].rsplit("test ").next().unwrap();
-                                   if let Some(ref mut v) = files.get_mut(path) {
+                                   if let Some(ref mut v) = files.get_mut(
+                                                                &path.replace('\\', "/")) {
                                        tested += 1;
                                        let mut iter = tmp[1].split("(line ");
                                        iter.next();