make assert_stderr_contains print its contents on panic · rust-lang/rust@b3c5132 (original) (raw)
5 files changed
lines changed
listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/output.txt
listings/ch11-writing-automated-tests/no-listing-04-bug-in-add-two/src/lib.rs
tests/testsuite/cargo_remove/invalid_target_dep/out/Cargo.toml
tests/testsuite/cargo_remove/invalid_target_dep/stderr.term.svg
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -236,18 +236,6 @@ impl Rustc { | ||
236 | 236 | self |
237 | 237 | } |
238 | 238 | |
239 | -/// Add an extra argument to prepend the linker invocation, via `-Zpre-link-arg`. | |
240 | - pub fn pre_link_arg(&mut self, link_arg: &str) -> &mut Self { | |
241 | -self.cmd.arg(format!("-Zpre-link-arg={link_arg}")); | |
242 | -self | |
243 | -} | |
244 | - | |
245 | -/// Add multiple extra arguments to the linker invocation, via `-Zpre-link-args`. | |
246 | - pub fn pre_link_args(&mut self, link_args: &str) -> &mut Self { | |
247 | -self.cmd.arg(format!("-Zpre-link-args={link_args}")); | |
248 | -self | |
249 | -} | |
250 | - | |
251 | 239 | /// Specify a stdin input |
252 | 240 | pub fn stdin<I: AsRef<[u8]>>(&mut self, input: I) -> &mut Self { |
253 | 241 | self.cmd.set_stdin(input.as_ref().to_vec().into_boxed_slice()); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -3,25 +3,28 @@ | ||
3 | 3 | // checks that linker arguments remain intact and in the order they were originally passed in. |
4 | 4 | // See https://github.com/rust-lang/rust/pull/70665 |
5 | 5 | |
6 | +//@ ignore-msvc | |
7 | +// Reason: the ld linker does not exist on Windows. | |
8 | + | |
6 | 9 | use run_make_support::rustc; |
7 | 10 | |
8 | 11 | fn main() { |
9 | 12 | rustc() |
10 | 13 | .input("empty.rs") |
11 | 14 | .linker_flavor("ld") |
12 | 15 | .link_arg("a") |
13 | -.link_args("\"b c\"") | |
14 | -.link_args("\"d e\"") | |
16 | +.link_args("b c") | |
17 | +.link_args("d e") | |
15 | 18 | .link_arg("f") |
16 | 19 | .run_fail() |
17 | -.assert_stderr_contains("\"a\" \"b\" \"c\" \"d\" \"e\" \"f\""); | |
20 | +.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#); | |
18 | 21 | rustc() |
19 | 22 | .input("empty.rs") |
20 | 23 | .linker_flavor("ld") |
21 | -.pre_link_arg("a") | |
22 | -.pre_link_args("\"b c\"") | |
23 | -.pre_link_args("\"d e\"") | |
24 | -.pre_link_arg("f") | |
24 | +.arg("-Zpre-link-arg=a") | |
25 | +.arg("-Zpre-link-args=b c") | |
26 | +.arg("-Zpre-link-args=d e") | |
27 | +.arg("-Zpre-link-arg=f") | |
25 | 28 | .run_fail() |
26 | -.assert_stderr_contains("\"a\" \"b\" \"c\" \"d\" \"e\" \"f\""); | |
29 | +.assert_stderr_contains(r#""a" "b" "c" "d" "e" "f""#); | |
27 | 30 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -8,18 +8,12 @@ | ||
8 | 8 | //@ ignore-cross-compile |
9 | 9 | |
10 | 10 | use run_make_support::fs_wrapper; |
11 | -use run_make_support::{cwd, run, rustc}; | |
11 | +use run_make_support::{run, rust_lib_name, rustc, test_while_readonly}; | |
12 | 12 | |
13 | 13 | fn main() { |
14 | 14 | rustc().input("lib.rs").run(); |
15 | -let entries = fs_wrapper::read_dir(cwd()); | |
16 | -for entry in entries { | |
17 | -if entry.path().extension().and_then(|s | |
18 | -let mut perms = fs_wrapper::metadata(entry.path()).permissions(); | |
19 | - perms.set_readonly(true); | |
20 | - fs_wrapper::set_permissions(entry.path(), perms); | |
21 | -} | |
22 | -} | |
23 | -rustc().input("main.rs").arg("-Clto").run(); | |
24 | -run("main"); | |
15 | +test_while_readonly(rust_lib_name("lib"), | | |
16 | +rustc().input("main.rs").arg("-Clto").run(); | |
17 | +run("main"); | |
18 | +}); | |
25 | 19 | } |