Skip to content

Commit 9ad93ad

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

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
@@ -5165,3 +5165,39 @@ fn custom_build_closes_stdin() {
51655165
.build();
51665166
p.cargo("build").run();
51675167
}
5168+
5169+
#[cargo_test]
5170+
fn test_both_two_semicolons_and_one_semicolon_syntax() {
5171+
let p = project()
5172+
.file(
5173+
"Cargo.toml",
5174+
r#"
5175+
[package]
5176+
name = "foo"
5177+
version = "0.0.1"
5178+
authors = []
5179+
build = "build.rs"
5180+
"#,
5181+
)
5182+
.file(
5183+
"src/main.rs",
5184+
r#"
5185+
const FOO: &'static str = env!("FOO");
5186+
const BAR: &'static str = env!("BAR");
5187+
fn main() {
5188+
println!("{}", FOO);
5189+
println!("{}", BAR);
5190+
}
5191+
"#,
5192+
)
5193+
.file(
5194+
"build.rs",
5195+
r#"fn main() {
5196+
println!("cargo::metadata=rustc-env=FOO=foo");
5197+
println!("cargo:rustc-env=BAR=bar");
5198+
}"#,
5199+
)
5200+
.build();
5201+
p.cargo("build -v").run();
5202+
p.cargo("run -v").with_stdout("foo\nbar\n").run();
5203+
}

0 commit comments

Comments
 (0)