Add a test for -Zbuild-std with custom test frameworks

This commit is contained in:
Philipp Oppermann 2019-09-13 15:11:13 +02:00
parent 18a897320b
commit 6b4fd44ea6

View file

@ -37,6 +37,7 @@ fn std_lib() {
hashbrown();
libc();
test();
custom_test_framework();
target_proc_macro();
bench();
doc();
@ -186,6 +187,47 @@ fn test() {
.run();
}
fn custom_test_framework() {
let p = project()
.file(
"src/lib.rs",
r#"
#![no_std]
#![cfg_attr(test, no_main)]
#![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)]
pub fn test_runner(_tests: &[&dyn Fn()]) {}
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
"#,
)
.file(
"target.json",
r#"
{
"llvm-target": "x86_64-unknown-none-gnu",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"executables": true,
"panic-strategy": "abort"
}
"#,
)
.build();
cargo_build_std(&p, "test --target target.json --no-run -v", "core").run();
}
fn target_proc_macro() {
let p = project()
.file(