Skip to content

Commit e606a43

Browse files
Fix rustdoc test with new file path
1 parent 047a215 commit e606a43

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/tools/compiletest/src/runtest.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1986,12 +1986,22 @@ actual:\n\
19861986
fn check_rustdoc_test_option(&self, res: ProcRes) {
19871987
let mut other_files = Vec::new();
19881988
let mut files: HashMap<String, Vec<usize>> = HashMap::new();
1989-
files.insert(self.testpaths.file.to_str().unwrap().to_owned(),
1989+
let cwd = env::current_dir().unwrap();
1990+
files.insert(self.testpaths.file.strip_prefix(&cwd)
1991+
.unwrap_or(&self.testpaths.file)
1992+
.to_str()
1993+
.unwrap()
1994+
.replace('\\', "/"),
19901995
self.get_lines(&self.testpaths.file, Some(&mut other_files)));
19911996
for other_file in other_files {
19921997
let mut path = self.testpaths.file.clone();
19931998
path.set_file_name(&format!("{}.rs", other_file));
1994-
files.insert(path.to_str().unwrap().to_owned(), self.get_lines(&path, None));
1999+
files.insert(path.strip_prefix(&cwd)
2000+
.unwrap_or(&path)
2001+
.to_str()
2002+
.unwrap()
2003+
.to_owned(),
2004+
self.get_lines(&path, None));
19952005
}
19962006

19972007
let mut tested = 0;
@@ -2001,7 +2011,8 @@ actual:\n\
20012011
let tmp: Vec<&str> = s.split(" - ").collect();
20022012
if tmp.len() == 2 {
20032013
let path = tmp[0].rsplit("test ").next().unwrap();
2004-
if let Some(ref mut v) = files.get_mut(path) {
2014+
if let Some(ref mut v) = files.get_mut(
2015+
&path.replace('\\', "/")) {
20052016
tested += 1;
20062017
let mut iter = tmp[1].split("(line ");
20072018
iter.next();

0 commit comments

Comments
 (0)