New test for cargo rustc --crate-type with dependency

This commit is contained in:
Weihang Lo 2022-02-13 17:42:12 +08:00
parent 229c48a0b9
commit 497051a743
No known key found for this signature in database
GPG key ID: D7DBF189825E82E7

View file

@ -231,6 +231,46 @@ fn build_with_crate_type_for_foo() {
.run();
}
#[cargo_test]
fn build_with_crate_type_for_foo_with_deps() {
let p = project()
.file(
"src/lib.rs",
r#"
extern crate a;
pub fn foo() { a::hello(); }
"#,
)
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
[dependencies]
a = { path = "a" }
"#,
)
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
.file("a/src/lib.rs", "pub fn hello() {}")
.build();
p.cargo("rustc -v --crate-type cdylib -Zunstable-options")
.masquerade_as_nightly_cargo()
.with_stderr(
"\
[COMPILING] a v0.1.0 ([CWD]/a)
[RUNNING] `rustc --crate-name a a/src/lib.rs [..]--crate-type lib [..]
[COMPILING] foo v0.0.1 ([CWD])
[RUNNING] `rustc --crate-name foo src/lib.rs [..]--crate-type cdylib [..]
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
.run();
}
#[cargo_test]
fn build_with_crate_types_for_foo() {
let p = project().file("src/lib.rs", "").build();