Skip to content

Commit 497051a

Browse files
committed
New test for cargo rustc --crate-type with dependency
1 parent 229c48a commit 497051a

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

tests/testsuite/rustc.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,46 @@ fn build_with_crate_type_for_foo() {
231231
.run();
232232
}
233233

234+
#[cargo_test]
235+
fn build_with_crate_type_for_foo_with_deps() {
236+
let p = project()
237+
.file(
238+
"src/lib.rs",
239+
r#"
240+
extern crate a;
241+
pub fn foo() { a::hello(); }
242+
"#,
243+
)
244+
.file(
245+
"Cargo.toml",
246+
r#"
247+
[package]
248+
name = "foo"
249+
version = "0.0.1"
250+
authors = []
251+
252+
[dependencies]
253+
a = { path = "a" }
254+
"#,
255+
)
256+
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
257+
.file("a/src/lib.rs", "pub fn hello() {}")
258+
.build();
259+
260+
p.cargo("rustc -v --crate-type cdylib -Zunstable-options")
261+
.masquerade_as_nightly_cargo()
262+
.with_stderr(
263+
"\
264+
[COMPILING] a v0.1.0 ([CWD]/a)
265+
[RUNNING] `rustc --crate-name a a/src/lib.rs [..]--crate-type lib [..]
266+
[COMPILING] foo v0.0.1 ([CWD])
267+
[RUNNING] `rustc --crate-name foo src/lib.rs [..]--crate-type cdylib [..]
268+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
269+
",
270+
)
271+
.run();
272+
}
273+
234274
#[cargo_test]
235275
fn build_with_crate_types_for_foo() {
236276
let p = project().file("src/lib.rs", "").build();

0 commit comments

Comments
 (0)