Skip to content

Commit

Permalink
Add a syntax test to make sure they all work
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
  • Loading branch information
Rustin170506 committed Jun 2, 2023
1 parent 24d58ae commit b8adc79
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5164,3 +5164,39 @@ fn custom_build_closes_stdin() {
.build();
p.cargo("build").run();
}

#[cargo_test]
fn test_both_two_semicolons_and_one_semicolon_syntax() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
build = "build.rs"
"#,
)
.file(
"src/main.rs",
r#"
const FOO: &'static str = env!("FOO");
const BAR: &'static str = env!("BAR");
fn main() {
println!("{}", FOO);
println!("{}", BAR);
}
"#,
)
.file(
"build.rs",
r#"fn main() {
println!("cargo::rustc-env=FOO=foo");
println!("cargo:rustc-env=BAR=bar");
}"#,
)
.build();
p.cargo("build -v").run();
p.cargo("run -v").with_stdout("foo\nbar\n").run();
}

0 comments on commit b8adc79

Please sign in to comment.