Skip to content

Commit b8adc79

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

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

0 commit comments

Comments
 (0)