Skip to content

Commit 18c604f

Browse files
committed
Added tests for #7217
1 parent fc94038 commit 18c604f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

tests/testsuite/build_script.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,65 @@ fn custom_build_script_rustc_flags() {
254254
.run();
255255
}
256256

257+
#[cargo_test]
258+
fn custom_build_script_rustc_flags_no_space() {
259+
let p = project()
260+
.file(
261+
"Cargo.toml",
262+
r#"
263+
[project]
264+
265+
name = "bar"
266+
version = "0.5.0"
267+
authors = ["wycats@example.com"]
268+
269+
[dependencies.foo]
270+
path = "foo"
271+
"#,
272+
)
273+
.file("src/main.rs", "fn main() {}")
274+
.file(
275+
"foo/Cargo.toml",
276+
r#"
277+
[project]
278+
279+
name = "foo"
280+
version = "0.5.0"
281+
authors = ["wycats@example.com"]
282+
build = "build.rs"
283+
"#,
284+
)
285+
.file("foo/src/lib.rs", "")
286+
.file(
287+
"foo/build.rs",
288+
r#"
289+
fn main() {
290+
println!("cargo:rustc-flags=-lnonexistinglib -L/dummy/path1 -L/dummy/path2");
291+
}
292+
"#,
293+
)
294+
.build();
295+
296+
p.cargo("build --verbose")
297+
.with_stderr(
298+
"\
299+
[COMPILING] foo [..]
300+
[RUNNING] `rustc --crate-name build_script_build foo/build.rs [..]
301+
[RUNNING] `[..]build-script-build`
302+
[RUNNING] `rustc --crate-name foo foo/src/lib.rs [..]\
303+
-L dependency=[CWD]/target/debug/deps \
304+
-L /dummy/path1 -L /dummy/path2 -l nonexistinglib`
305+
[COMPILING] bar [..]
306+
[RUNNING] `rustc --crate-name bar src/main.rs [..]\
307+
-L dependency=[CWD]/target/debug/deps \
308+
--extern foo=[..]libfoo-[..] \
309+
-L /dummy/path1 -L /dummy/path2`
310+
[FINISHED] dev [..]
311+
",
312+
)
313+
.run();
314+
}
315+
257316
#[cargo_test]
258317
fn links_no_build_cmd() {
259318
let p = project()

0 commit comments

Comments
 (0)