Skip to content

Commit

Permalink
Add a test for -Zbuild-std with custom test frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Sep 15, 2019
1 parent 18a8973 commit 6b4fd44
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/testsuite/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn std_lib() {
hashbrown();
libc();
test();
custom_test_framework();
target_proc_macro();
bench();
doc();
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 6b4fd44

Please sign in to comment.