Skip to content

Commit 4ea02bb

Browse files
committed
Add a syntax test to make sure they all work
Signed-off-by: hi-rustin <[email protected]>
1 parent c3f8b2f commit 4ea02bb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/testsuite/build_script.rs

+36
Original file line numberDiff line numberDiff line change
@@ -5168,3 +5168,39 @@ fn custom_build_closes_stdin() {
51685168
.build();
51695169
p.cargo("build").run();
51705170
}
5171+
5172+
#[cargo_test]
5173+
fn test_both_two_semicolons_and_one_semicolon_syntax() {
5174+
let p = project()
5175+
.file(
5176+
"Cargo.toml",
5177+
r#"
5178+
[package]
5179+
name = "foo"
5180+
version = "0.0.1"
5181+
authors = []
5182+
build = "build.rs"
5183+
"#,
5184+
)
5185+
.file(
5186+
"src/main.rs",
5187+
r#"
5188+
const FOO: &'static str = env!("FOO");
5189+
const BAR: &'static str = env!("BAR");
5190+
fn main() {
5191+
println!("{}", FOO);
5192+
println!("{}", BAR);
5193+
}
5194+
"#,
5195+
)
5196+
.file(
5197+
"build.rs",
5198+
r#"fn main() {
5199+
println!("cargo::metadata=rustc-env=FOO=foo");
5200+
println!("cargo:rustc-env=BAR=bar");
5201+
}"#,
5202+
)
5203+
.build();
5204+
p.cargo("build -v").run();
5205+
p.cargo("run -v").with_stdout("foo\nbar\n").run();
5206+
}

0 commit comments

Comments
 (0)