Skip to content

Commit f3d328c

Browse files
committed
Tweak tests that check whether the build script is being run
1 parent 13b74cb commit f3d328c

File tree

1 file changed

+11
-29
lines changed

1 file changed

+11
-29
lines changed

tests/test_cargo_compile_custom_build.rs

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,6 @@ use hamcrest::{assert_that};
77
fn setup() {
88
}
99

10-
test!(custom_build_compiled {
11-
let p = project("foo")
12-
.file("Cargo.toml", r#"
13-
[project]
14-
15-
name = "foo"
16-
version = "0.5.0"
17-
authors = ["[email protected]"]
18-
build = "build.rs"
19-
"#)
20-
.file("src/main.rs", r#"
21-
fn main() {}
22-
"#)
23-
.file("build.rs", r#"
24-
invalid rust file, should trigger a build error
25-
"#);
26-
27-
assert_that(p.cargo_process("build"),
28-
execs().with_status(101));
29-
})
30-
31-
/*
3210
test!(custom_build_script_failed {
3311
let p = project("foo")
3412
.file("Cargo.toml", r#"
@@ -47,14 +25,18 @@ test!(custom_build_script_failed {
4725
std::os::set_exit_status(101);
4826
}
4927
"#);
50-
assert_that(p.cargo_process("build"),
28+
assert_that(p.cargo_process("build").arg("-v"),
5129
execs().with_status(101)
30+
.with_stdout(format!("\
31+
{compiling} foo v0.5.0 ({url})
32+
{running} `rustc build.rs --crate-name build-script-build --crate-type bin [..]`
33+
",
34+
url = p.url(), compiling = COMPILING, running = RUNNING))
5235
.with_stderr(format!("\
53-
Failed to run custom build command for `foo v0.5.0 (file://{})`
54-
Process didn't exit successfully: `{}` (status=101)", // TODO: TEST FAILS BECAUSE OF WRONG PATH
55-
p.root().display(), p.bin("build-script-build").display())));
36+
Failed to run custom build command for `foo v0.5.0 ({})`
37+
Process didn't exit successfully: `[..]build[..]build-script-build` (status=101)",
38+
p.url())));
5639
})
57-
*/
5840

5941
test!(custom_build_env_vars {
6042
let p = project("foo")
@@ -149,10 +131,10 @@ test!(custom_build_script_wrong_rustc_flags {
149131
assert_that(p.cargo_process("build"),
150132
execs().with_status(101)
151133
.with_stderr(format!("\
152-
Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 (file://{})`:
134+
Only `-l` and `-L` flags are allowed in build script of `foo v0.5.0 ({})`:
153135
`-aaa -bbb
154136
`",
155-
p.root().display())));
137+
p.url())));
156138
})
157139

158140
/*

0 commit comments

Comments
 (0)