Skip to content

Commit 3d81806

Browse files
committed
remove mode for run and ignore tests
1 parent 4ce2e33 commit 3d81806

26 files changed

+55
-46
lines changed

library/test/src/formatters/pretty.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ impl<T: Write> PrettyFormatter<T> {
169169

170170
fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
171171
let name = desc.padded_name(self.max_name_len, desc.name.padding());
172-
self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?;
172+
let test_mode = desc.test_mode();
173+
if test_mode == "" {
174+
self.write_plain(&format!("test {} ... ", name))?;
175+
} else {
176+
self.write_plain(&format!("test {} - {} ... ", name, test_mode))?;
177+
}
173178

174179
Ok(())
175180
}

library/test/src/formatters/terse.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ impl<T: Write> TerseFormatter<T> {
158158

159159
fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
160160
let name = desc.padded_name(self.max_name_len, desc.name.padding());
161-
self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?;
161+
let test_mode = desc.test_mode();
162+
if test_mode == "" {
163+
self.write_plain(&format!("test {} ... ", name))?;
164+
} else {
165+
self.write_plain(&format!("test {} - {} ... ", name, test_mode))?;
166+
}
162167

163168
Ok(())
164169
}

library/test/src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl TestDesc {
148148
#[cfg(not(bootstrap))]
149149
pub fn test_mode(&self) -> &'static str {
150150
if self.ignore {
151-
return &"ignore";
151+
return &"";
152152
}
153153
match self.should_panic {
154154
options::ShouldPanic::Yes | options::ShouldPanic::YesWithMessage(_) => {
@@ -165,7 +165,7 @@ impl TestDesc {
165165
if self.no_run {
166166
return &"compile";
167167
}
168-
&"run"
168+
&""
169169
}
170170

171171
#[cfg(bootstrap)]

src/test/run-make-fulldeps/issue-22131/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ all: foo.rs
44
$(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs
55
$(RUSTDOC) --test --cfg 'feature="bar"' \
66
-L $(TMPDIR) foo.rs |\
7-
$(CGREP) 'foo.rs - foo (line 1) - run ... ok'
7+
$(CGREP) 'foo.rs - foo (line 1) ... ok'

src/test/run-make-fulldeps/test-harness/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
all:
44
# check that #[cfg_attr(..., ignore)] does the right thing.
55
$(RUSTC) --test test-ignore-cfg.rs --cfg ignorecfg
6-
$(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore - run ... ok' 'shouldignore - ignore ... ignored'
6+
$(call RUN,test-ignore-cfg) | $(CGREP) 'shouldnotignore ... ok' 'shouldignore ... ignored'
77
$(call RUN,test-ignore-cfg --quiet) | $(CGREP) -e "^i\.$$"
88
$(call RUN,test-ignore-cfg --quiet) | $(CGREP) -v 'should'

src/test/rustdoc-ui/cfg-test.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 2 tests
3-
test $DIR/cfg-test.rs - Bar (line 27) - run ... ok
4-
test $DIR/cfg-test.rs - Foo (line 19) - run ... ok
3+
test $DIR/cfg-test.rs - Bar (line 27) ... ok
4+
test $DIR/cfg-test.rs - Foo (line 19) ... ok
55

66
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
77

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/doc-test-doctest-feature.rs - Foo (line 9) - run ... ok
3+
test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) - run ... ok
3+
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
running 3 tests
3-
test $DIR/doctest-output.rs - (line 8) - run ... ok
4-
test $DIR/doctest-output.rs - ExpandedStruct (line 24) - run ... ok
5-
test $DIR/doctest-output.rs - foo::bar (line 18) - run ... ok
3+
test $DIR/doctest-output.rs - (line 8) ... ok
4+
test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok
5+
test $DIR/doctest-output.rs - foo::bar (line 18) ... ok
66

77
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
88

src/test/rustdoc-ui/failed-doctest-output.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 2 tests
3-
test $DIR/failed-doctest-output.rs - OtherStruct (line 22) - run ... FAILED
4-
test $DIR/failed-doctest-output.rs - SomeStruct (line 12) - run ... FAILED
3+
test $DIR/failed-doctest-output.rs - OtherStruct (line 22) ... FAILED
4+
test $DIR/failed-doctest-output.rs - SomeStruct (line 12) ... FAILED
55

66
failures:
77

src/test/rustdoc-ui/failed-doctest-should-panic.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/failed-doctest-should-panic.rs - Foo (line 9) - run ... FAILED
3+
test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED
44

55
failures:
66

src/test/rustdoc-ui/issue-81662-shortness.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/issue-81662-shortness.rs - foo (line 6) - run ... FAILED
3+
test $DIR/issue-81662-shortness.rs - foo (line 6) ... FAILED
44

55
failures:
66

src/test/rustdoc-ui/no-run-flag.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 7 tests
33
test $DIR/no-run-flag.rs - f (line 11) - compile ... ok
4-
test $DIR/no-run-flag.rs - f (line 14) - ignore ... ignored
4+
test $DIR/no-run-flag.rs - f (line 14) ... ignored
55
test $DIR/no-run-flag.rs - f (line 17) - compile ... ok
66
test $DIR/no-run-flag.rs - f (line 23) - compile fail ... ok
77
test $DIR/no-run-flag.rs - f (line 28) - compile ... ok
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/run-directory.rs - foo (line 10) - run ... ok
3+
test $DIR/run-directory.rs - foo (line 10) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/run-directory.rs - foo (line 19) - run ... ok
3+
test $DIR/run-directory.rs - foo (line 19) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/test-no_std.rs - f (line 10) - run ... ok
3+
test $DIR/test-no_std.rs - f (line 10) ... ok
44

55
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
66

src/test/rustdoc-ui/test-type.stdout

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
running 5 tests
3-
test $DIR/test-type.rs - f (line 12) - ignore ... ignored
3+
test $DIR/test-type.rs - f (line 12) ... ignored
44
test $DIR/test-type.rs - f (line 15) - compile ... ok
55
test $DIR/test-type.rs - f (line 21) - compile fail ... ok
6-
test $DIR/test-type.rs - f (line 6) - run ... ok
7-
test $DIR/test-type.rs - f (line 9) - run ... ok
6+
test $DIR/test-type.rs - f (line 6) ... ok
7+
test $DIR/test-type.rs - f (line 9) ... ok
88

99
test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
1010

src/test/rustdoc-ui/unparseable-doc-test.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
running 1 test
3-
test $DIR/unparseable-doc-test.rs - foo (line 7) - run ... FAILED
3+
test $DIR/unparseable-doc-test.rs - foo (line 7) ... FAILED
44

55
failures:
66

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 2 tests
3-
test test1 - run ... ok
4-
test test2 - run ... ok
3+
test test1 ... ok
4+
test test2 ... ok
55

66
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME
77

src/test/ui/test-attrs/test-type.run.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 3 tests
3-
test test_no_run - ignore ... ignored
4-
test test_ok - run ... ok
3+
test test_no_run ... ignored
4+
test test_ok ... ok
55
test test_panic - should panic ... ok
66

77
test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME

src/test/ui/test-panic-abort-nocapture.run.stdout

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
running 4 tests
3-
test it_fails - run ... about to fail
3+
test it_fails ... about to fail
44
FAILED
55
test it_panics - should panic ... about to panic
66
ok
7-
test it_works - run ... about to succeed
7+
test it_works ... about to succeed
88
ok
9-
test it_writes_to_stdio - run ... hello, world
9+
test it_writes_to_stdio ... hello, world
1010
testing123
1111
ok
1212

src/test/ui/test-panic-abort.run.stdout

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
running 5 tests
3-
test it_exits - run ... FAILED
4-
test it_fails - run ... FAILED
3+
test it_exits ... FAILED
4+
test it_fails ... FAILED
55
test it_panics - should panic ... ok
6-
test it_works - run ... ok
7-
test no_residual_environment - run ... ok
6+
test it_works ... ok
7+
test no_residual_environment ... ok
88

99
failures:
1010

src/test/ui/test-passed.run.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 2 tests
3-
test it_works - run ... ok
4-
test it_works_too - run ... ok
3+
test it_works ... ok
4+
test it_works_too ... ok
55

66
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
77

src/test/ui/test-thread-capture.run.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
running 2 tests
3-
test thready_fail - run ... FAILED
4-
test thready_pass - run ... ok
3+
test thready_fail ... FAILED
4+
test thready_pass ... ok
55

66
failures:
77

src/test/ui/test-thread-nocapture.run.stdout

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
running 2 tests
3-
test thready_fail - run ... fee
3+
test thready_fail ... fee
44
fie
55
foe
66
fum
77
FAILED
8-
test thready_pass - run ... fee
8+
test thready_pass ... fee
99
fie
1010
foe
1111
fum

src/tools/compiletest/src/runtest.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -2637,12 +2637,11 @@ impl<'test> TestCx<'test> {
26372637

26382638
let mut tested = 0;
26392639
for _ in res.stdout.split('\n').filter(|s| s.starts_with("test ")).inspect(|s| {
2640-
let tmp: Vec<&str> = s.split(" - ").collect();
2641-
if tmp.len() == 3 {
2642-
let path = tmp[0].rsplit("test ").next().unwrap();
2640+
if let Some((left, right)) = s.split_once(" - ") {
2641+
let path = left.rsplit("test ").next().unwrap();
26432642
if let Some(ref mut v) = files.get_mut(&path.replace('\\', "/")) {
26442643
tested += 1;
2645-
let mut iter = tmp[1].split("(line ");
2644+
let mut iter = right.split("(line ");
26462645
iter.next();
26472646
let line = iter
26482647
.next()

0 commit comments

Comments
 (0)