Skip to content

Commit 6a980bc

Browse files
committed
Add new test case 'test_std_on_unsupported_target'
Add a new test case to check cargo handles building a target which doesn't support the standard library properly.
1 parent 5e4a1db commit 6a980bc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/testsuite/standard_lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,32 @@ fn check_core() {
323323
.run();
324324
}
325325

326+
#[cargo_test(build_std_mock)]
327+
fn test_std_on_unsupported_target() {
328+
let setup = setup();
329+
330+
let p = project()
331+
.file(
332+
"src/main.rs",
333+
r#"
334+
fn main() {
335+
println!("hello");
336+
}
337+
"#,
338+
)
339+
.build();
340+
341+
p.cargo("build")
342+
.arg("--target=aarch64-unknown-none")
343+
.arg("--target=x86_64-unknown-none")
344+
.build_std(&setup)
345+
.with_status(101)
346+
.with_stderr_data(str![[r#"
347+
[ERROR] building std is not supported on the following targets: [..]
348+
"#]])
349+
.run();
350+
}
351+
326352
#[cargo_test(build_std_mock)]
327353
fn depend_same_as_std() {
328354
let setup = setup();

0 commit comments

Comments
 (0)