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 <[email protected]>
  • Loading branch information
Rustin170506 committed May 31, 2023
1 parent c3f8b2f commit 4ea02bb
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 @@ -5168,3 +5168,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::metadata=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 4ea02bb

Please sign in to comment.