Add tested item in the rustdoc --test output
This commit is contained in:
parent
bae454edc5
commit
c951ed7fb6
3 changed files with 17 additions and 9 deletions
|
@ -418,8 +418,12 @@ impl Collector {
|
||||||
should_panic: bool, no_run: bool, should_ignore: bool,
|
should_panic: bool, no_run: bool, should_ignore: bool,
|
||||||
as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>,
|
as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>,
|
||||||
line: usize, filename: String) {
|
line: usize, filename: String) {
|
||||||
let name = format!("{} - line {}", filename, line);
|
let name = if self.use_headers {
|
||||||
self.cnt += 1;
|
let s = self.current_header.as_ref().map(|s| &**s).unwrap_or("");
|
||||||
|
format!("{} - {} (line {})", filename, s, line)
|
||||||
|
} else {
|
||||||
|
format!("{} - {} (line {})", filename, self.names.join("::"), line)
|
||||||
|
};
|
||||||
let cfgs = self.cfgs.clone();
|
let cfgs = self.cfgs.clone();
|
||||||
let libs = self.libs.clone();
|
let libs = self.libs.clone();
|
||||||
let externs = self.externs.clone();
|
let externs = self.externs.clone();
|
||||||
|
|
|
@ -4,4 +4,4 @@ all: foo.rs
|
||||||
$(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs
|
$(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs
|
||||||
$(HOST_RPATH_ENV) '$(RUSTDOC)' --test --cfg 'feature="bar"' \
|
$(HOST_RPATH_ENV) '$(RUSTDOC)' --test --cfg 'feature="bar"' \
|
||||||
-L $(TMPDIR) foo.rs |\
|
-L $(TMPDIR) foo.rs |\
|
||||||
grep -q 'foo.rs - line 11 ... ok'
|
grep -q 'foo.rs - foo (line 11) ... ok'
|
||||||
|
|
|
@ -1998,16 +1998,20 @@ actual:\n\
|
||||||
for _ in res.stdout.split("\n")
|
for _ in res.stdout.split("\n")
|
||||||
.filter(|s| s.starts_with("test "))
|
.filter(|s| s.starts_with("test "))
|
||||||
.inspect(|s| {
|
.inspect(|s| {
|
||||||
let tmp: Vec<&str> = s.split(" - line ").collect();
|
let tmp: Vec<&str> = s.split(" - ").collect();
|
||||||
if tmp.len() == 2 {
|
if tmp.len() == 2 {
|
||||||
let path = tmp[0].rsplit("test ").next().unwrap();
|
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) {
|
||||||
tested += 1;
|
tested += 1;
|
||||||
let line = tmp[1].split(" ...")
|
let mut iter = tmp[1].split("(line ");
|
||||||
.next()
|
iter.next();
|
||||||
.unwrap_or("0")
|
let line = iter.next()
|
||||||
.parse()
|
.unwrap_or(")")
|
||||||
.unwrap_or(0);
|
.split(")")
|
||||||
|
.next()
|
||||||
|
.unwrap_or("0")
|
||||||
|
.parse()
|
||||||
|
.unwrap_or(0);
|
||||||
if let Ok(pos) = v.binary_search(&line) {
|
if let Ok(pos) = v.binary_search(&line) {
|
||||||
v.remove(pos);
|
v.remove(pos);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue