mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
proof of concept add test type on prints
This commit is contained in:
parent
89ebad52a8
commit
347ed001e8
@ -254,6 +254,10 @@ pub fn expand_test_or_bench(
|
|||||||
"allow_fail",
|
"allow_fail",
|
||||||
cx.expr_bool(sp, should_fail(&cx.sess, &item)),
|
cx.expr_bool(sp, should_fail(&cx.sess, &item)),
|
||||||
),
|
),
|
||||||
|
// compile_fail: true | false
|
||||||
|
field("compile_fail", cx.expr_bool(sp, false)),
|
||||||
|
// no_run: true | false
|
||||||
|
field("no_run", cx.expr_bool(sp, false)),
|
||||||
// should_panic: ...
|
// should_panic: ...
|
||||||
field(
|
field(
|
||||||
"should_panic",
|
"should_panic",
|
||||||
|
@ -169,7 +169,7 @@ impl<T: Write> PrettyFormatter<T> {
|
|||||||
|
|
||||||
fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
|
fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
|
||||||
let name = desc.padded_name(self.max_name_len, desc.name.padding());
|
let name = desc.padded_name(self.max_name_len, desc.name.padding());
|
||||||
self.write_plain(&format!("test {} ... ", name))?;
|
self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ impl<T: Write> TerseFormatter<T> {
|
|||||||
|
|
||||||
fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
|
fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
|
||||||
let name = desc.padded_name(self.max_name_len, desc.name.padding());
|
let name = desc.padded_name(self.max_name_len, desc.name.padding());
|
||||||
self.write_plain(&format!("test {} ... ", name))?;
|
self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
|
|||||||
ignore: true,
|
ignore: true,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(move || {})),
|
testfn: DynTestFn(Box::new(move || {})),
|
||||||
@ -71,6 +73,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(move || {})),
|
testfn: DynTestFn(Box::new(move || {})),
|
||||||
@ -89,6 +93,8 @@ pub fn do_not_run_ignored_tests() {
|
|||||||
ignore: true,
|
ignore: true,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -108,6 +114,8 @@ pub fn ignored_tests_result_in_ignored() {
|
|||||||
ignore: true,
|
ignore: true,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -131,6 +139,8 @@ fn test_should_panic() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::Yes,
|
should_panic: ShouldPanic::Yes,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -154,6 +164,8 @@ fn test_should_panic_good_message() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::YesWithMessage("error message"),
|
should_panic: ShouldPanic::YesWithMessage("error message"),
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -182,6 +194,8 @@ fn test_should_panic_bad_message() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::YesWithMessage(expected),
|
should_panic: ShouldPanic::YesWithMessage(expected),
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -214,6 +228,8 @@ fn test_should_panic_non_string_message_type() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::YesWithMessage(expected),
|
should_panic: ShouldPanic::YesWithMessage(expected),
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -238,6 +254,8 @@ fn test_should_panic_but_succeeds() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic,
|
should_panic,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -270,6 +288,8 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -303,6 +323,8 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type,
|
test_type,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(f)),
|
testfn: DynTestFn(Box::new(f)),
|
||||||
@ -340,6 +362,8 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type,
|
test_type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -451,6 +475,8 @@ pub fn exclude_should_panic_option() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::Yes,
|
should_panic: ShouldPanic::Yes,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(move || {})),
|
testfn: DynTestFn(Box::new(move || {})),
|
||||||
@ -473,6 +499,8 @@ pub fn exact_filter_match() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(move || {})),
|
testfn: DynTestFn(Box::new(move || {})),
|
||||||
@ -565,6 +593,8 @@ pub fn sort_tests() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: DynTestFn(Box::new(testfn)),
|
testfn: DynTestFn(Box::new(testfn)),
|
||||||
@ -642,6 +672,8 @@ pub fn test_bench_no_iter() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -662,6 +694,8 @@ pub fn test_bench_iter() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -676,6 +710,8 @@ fn should_sort_failures_before_printing_them() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -684,6 +720,8 @@ fn should_sort_failures_before_printing_them() {
|
|||||||
ignore: false,
|
ignore: false,
|
||||||
should_panic: ShouldPanic::No,
|
should_panic: ShouldPanic::No,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: TestType::Unknown,
|
test_type: TestType::Unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,6 +124,8 @@ pub struct TestDesc {
|
|||||||
pub ignore: bool,
|
pub ignore: bool,
|
||||||
pub should_panic: options::ShouldPanic,
|
pub should_panic: options::ShouldPanic,
|
||||||
pub allow_fail: bool,
|
pub allow_fail: bool,
|
||||||
|
pub compile_fail: bool,
|
||||||
|
pub no_run: bool,
|
||||||
pub test_type: TestType,
|
pub test_type: TestType,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +142,28 @@ impl TestDesc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn test_mode_string(&self) -> String {
|
||||||
|
if self.ignore {
|
||||||
|
return "ignore".to_string();
|
||||||
|
}
|
||||||
|
match self.should_panic {
|
||||||
|
options::ShouldPanic::Yes | options::ShouldPanic::YesWithMessage(_) => {
|
||||||
|
return "should panic".to_string();
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
if self.allow_fail {
|
||||||
|
return "allow fail".to_string();
|
||||||
|
}
|
||||||
|
if self.compile_fail {
|
||||||
|
return "compile fail".to_string();
|
||||||
|
}
|
||||||
|
if self.no_run {
|
||||||
|
return "compile".to_string();
|
||||||
|
}
|
||||||
|
"run".to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -879,6 +879,7 @@ impl Tester for Collector {
|
|||||||
let target = self.options.target.clone();
|
let target = self.options.target.clone();
|
||||||
let target_str = target.to_string();
|
let target_str = target.to_string();
|
||||||
let unused_externs = self.unused_extern_reports.clone();
|
let unused_externs = self.unused_extern_reports.clone();
|
||||||
|
let no_run = config.no_run || options.no_run;
|
||||||
if !config.compile_fail {
|
if !config.compile_fail {
|
||||||
self.compiling_test_count.fetch_add(1, Ordering::SeqCst);
|
self.compiling_test_count.fetch_add(1, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
@ -934,13 +935,14 @@ impl Tester for Collector {
|
|||||||
// compiler failures are test failures
|
// compiler failures are test failures
|
||||||
should_panic: testing::ShouldPanic::No,
|
should_panic: testing::ShouldPanic::No,
|
||||||
allow_fail: config.allow_fail,
|
allow_fail: config.allow_fail,
|
||||||
|
compile_fail: config.compile_fail,
|
||||||
|
no_run,
|
||||||
test_type: testing::TestType::DocTest,
|
test_type: testing::TestType::DocTest,
|
||||||
},
|
},
|
||||||
testfn: testing::DynTestFn(box move || {
|
testfn: testing::DynTestFn(box move || {
|
||||||
let report_unused_externs = |uext| {
|
let report_unused_externs = |uext| {
|
||||||
unused_externs.lock().unwrap().push(uext);
|
unused_externs.lock().unwrap().push(uext);
|
||||||
};
|
};
|
||||||
let no_run = config.no_run || options.no_run;
|
|
||||||
let res = run_test(
|
let res = run_test(
|
||||||
&test,
|
&test,
|
||||||
&cratename,
|
&cratename,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
test $DIR/cfg-test.rs - Bar (line 27) ... ok
|
test $DIR/cfg-test.rs - Bar (line 27) run ... ok
|
||||||
test $DIR/cfg-test.rs - Foo (line 19) ... ok
|
test $DIR/cfg-test.rs - Foo (line 19) run ... ok
|
||||||
|
|
||||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok
|
test $DIR/doc-test-doctest-feature.rs - Foo (line 9) run ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok
|
test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) run ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
running 3 tests
|
running 3 tests
|
||||||
test $DIR/doctest-output.rs - (line 8) ... ok
|
test $DIR/doctest-output.rs - (line 8) run ... ok
|
||||||
test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok
|
test $DIR/doctest-output.rs - ExpandedStruct (line 24) run ... ok
|
||||||
test $DIR/doctest-output.rs - foo::bar (line 18) ... ok
|
test $DIR/doctest-output.rs - foo::bar (line 18) run ... ok
|
||||||
|
|
||||||
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) ... FAILED
|
test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) compile fail ... FAILED
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) ... FAILED
|
test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) compile fail ... FAILED
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
test $DIR/failed-doctest-output.rs - OtherStruct (line 22) ... FAILED
|
test $DIR/failed-doctest-output.rs - OtherStruct (line 22) run ... FAILED
|
||||||
test $DIR/failed-doctest-output.rs - SomeStruct (line 12) ... FAILED
|
test $DIR/failed-doctest-output.rs - SomeStruct (line 12) run ... FAILED
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED
|
test $DIR/failed-doctest-should-panic.rs - Foo (line 9) run ... FAILED
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/issue-80992.rs - test (line 7) ... ok
|
test $DIR/issue-80992.rs - test (line 7) compile fail ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/issue-81662-shortness.rs - foo (line 6) ... FAILED
|
test $DIR/issue-81662-shortness.rs - foo (line 6) run ... FAILED
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
running 7 tests
|
running 7 tests
|
||||||
test $DIR/no-run-flag.rs - f (line 11) ... ok
|
test $DIR/no-run-flag.rs - f (line 11) compile ... ok
|
||||||
test $DIR/no-run-flag.rs - f (line 14) ... ignored
|
test $DIR/no-run-flag.rs - f (line 14) ignore ... ignored
|
||||||
test $DIR/no-run-flag.rs - f (line 17) ... ok
|
test $DIR/no-run-flag.rs - f (line 17) compile ... ok
|
||||||
test $DIR/no-run-flag.rs - f (line 23) ... ok
|
test $DIR/no-run-flag.rs - f (line 23) compile fail ... ok
|
||||||
test $DIR/no-run-flag.rs - f (line 28) ... ok
|
test $DIR/no-run-flag.rs - f (line 28) compile ... ok
|
||||||
test $DIR/no-run-flag.rs - f (line 32) ... ok
|
test $DIR/no-run-flag.rs - f (line 32) compile ... ok
|
||||||
test $DIR/no-run-flag.rs - f (line 8) ... ok
|
test $DIR/no-run-flag.rs - f (line 8) compile ... ok
|
||||||
|
|
||||||
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/run-directory.rs - foo (line 10) ... ok
|
test $DIR/run-directory.rs - foo (line 10) run ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/run-directory.rs - foo (line 19) ... ok
|
test $DIR/run-directory.rs - foo (line 19) run ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/test-no_std.rs - f (line 10) ... ok
|
test $DIR/test-no_std.rs - f (line 10) run ... ok
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
26
src/test/rustdoc-ui/test-type.rs
Normal file
26
src/test/rustdoc-ui/test-type.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// compile-flags: --test --test-args=--test-threads=1
|
||||||
|
// check-pass
|
||||||
|
// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
|
||||||
|
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||||
|
|
||||||
|
/// ```
|
||||||
|
/// let a = true;
|
||||||
|
/// ```
|
||||||
|
/// ```should_panic
|
||||||
|
/// panic!()
|
||||||
|
/// ```
|
||||||
|
/// ```ignore (incomplete-code)
|
||||||
|
/// fn foo() {
|
||||||
|
/// ```
|
||||||
|
/// ```no_run
|
||||||
|
/// loop {
|
||||||
|
/// println!("Hello, world");
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
/// fails to compile
|
||||||
|
/// ```compile_fail
|
||||||
|
/// let x = 5;
|
||||||
|
/// x += 2; // shouldn't compile!
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
pub fn f() {}
|
10
src/test/rustdoc-ui/test-type.stdout
Normal file
10
src/test/rustdoc-ui/test-type.stdout
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
running 5 tests
|
||||||
|
test $DIR/test-type.rs - f (line 12) ignore ... ignored
|
||||||
|
test $DIR/test-type.rs - f (line 15) compile ... ok
|
||||||
|
test $DIR/test-type.rs - f (line 21) compile fail ... ok
|
||||||
|
test $DIR/test-type.rs - f (line 6) run ... ok
|
||||||
|
test $DIR/test-type.rs - f (line 9) run ... ok
|
||||||
|
|
||||||
|
test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
running 1 test
|
running 1 test
|
||||||
test $DIR/unparseable-doc-test.rs - foo (line 7) ... FAILED
|
test $DIR/unparseable-doc-test.rs - foo (line 7) run ... FAILED
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
test test1 ... ok
|
test test1 run ... ok
|
||||||
test test2 ... ok
|
test test2 run ... ok
|
||||||
|
|
||||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME
|
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
28
src/test/ui/test-attrs/test-type.rs
Normal file
28
src/test/ui/test-attrs/test-type.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// compile-flags: --test
|
||||||
|
// run-flags: --test-threads=1
|
||||||
|
// check-run-results
|
||||||
|
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||||
|
// ignore-emscripten no threads support
|
||||||
|
// run-pass
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_ok() {
|
||||||
|
let _a = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic]
|
||||||
|
fn test_panic() {
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn test_no_run() {
|
||||||
|
loop{
|
||||||
|
println!("Hello, world");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
8
src/test/ui/test-attrs/test-type.run.stdout
Normal file
8
src/test/ui/test-attrs/test-type.run.stdout
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
running 3 tests
|
||||||
|
test test_no_run ignore ... ignored
|
||||||
|
test test_ok run ... ok
|
||||||
|
test test_panic should panic ... ok
|
||||||
|
|
||||||
|
test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
running 4 tests
|
running 4 tests
|
||||||
test it_fails ... about to fail
|
test it_fails run ... about to fail
|
||||||
FAILED
|
FAILED
|
||||||
test it_panics ... about to panic
|
test it_panics should panic ... about to panic
|
||||||
ok
|
ok
|
||||||
test it_works ... about to succeed
|
test it_works run ... about to succeed
|
||||||
ok
|
ok
|
||||||
test it_writes_to_stdio ... hello, world
|
test it_writes_to_stdio run ... hello, world
|
||||||
testing123
|
testing123
|
||||||
ok
|
ok
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
running 5 tests
|
running 5 tests
|
||||||
test it_exits ... FAILED
|
test it_exits run ... FAILED
|
||||||
test it_fails ... FAILED
|
test it_fails run ... FAILED
|
||||||
test it_panics ... ok
|
test it_panics should panic ... ok
|
||||||
test it_works ... ok
|
test it_works run ... ok
|
||||||
test no_residual_environment ... ok
|
test no_residual_environment run ... ok
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
test it_works ... ok
|
test it_works run ... ok
|
||||||
test it_works_too ... ok
|
test it_works_too run ... ok
|
||||||
|
|
||||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
test thready_fail ... FAILED
|
test thready_fail run ... FAILED
|
||||||
test thready_pass ... ok
|
test thready_pass run ... ok
|
||||||
|
|
||||||
failures:
|
failures:
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
running 2 tests
|
running 2 tests
|
||||||
test thready_fail ... fee
|
test thready_fail run ... fee
|
||||||
fie
|
fie
|
||||||
foe
|
foe
|
||||||
fum
|
fum
|
||||||
FAILED
|
FAILED
|
||||||
test thready_pass ... fee
|
test thready_pass run ... fee
|
||||||
fie
|
fie
|
||||||
foe
|
foe
|
||||||
fum
|
fum
|
||||||
|
@ -649,6 +649,8 @@ fn make_test(config: &Config, testpaths: &TestPaths, inputs: &Stamp) -> Vec<test
|
|||||||
ignore,
|
ignore,
|
||||||
should_panic,
|
should_panic,
|
||||||
allow_fail: false,
|
allow_fail: false,
|
||||||
|
compile_fail: false,
|
||||||
|
no_run: false,
|
||||||
test_type: test::TestType::Unknown,
|
test_type: test::TestType::Unknown,
|
||||||
},
|
},
|
||||||
testfn: make_test_closure(config, testpaths, revision),
|
testfn: make_test_closure(config, testpaths, revision),
|
||||||
|
Loading…
Reference in New Issue
Block a user