Skip to content

Commit 4909fd8

Browse files
committed
Add tests for invoking multiple help options at once
1 parent adbdf8d commit 4909fd8

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

tests/run-make/rustc-help/rmake.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,31 @@ fn main() {
1818
// Check the diff between `rustc --help` and `rustc --help -v`.
1919
let help_v_diff = similar::TextDiff::from_lines(&help, &help_v).unified_diff().to_string();
2020
diff().expected_file("help-v.diff").actual_text("actual", &help_v_diff).run();
21+
22+
// Check that all help options can be invoked at once
23+
let codegen_help = bare_rustc().arg("-Chelp").run().stdout_utf8();
24+
let unstable_help = bare_rustc().arg("-Zhelp").run().stdout_utf8();
25+
let lints_help = bare_rustc().arg("-Whelp").run().stdout_utf8();
26+
let expected_all = format!("{help}{codegen_help}{unstable_help}{lints_help}");
27+
let all_help = bare_rustc().args(["--help", "-Chelp", "-Zhelp", "-Whelp"]).run().stdout_utf8();
28+
diff()
29+
.expected_text(
30+
"(rustc --help && rustc -Chelp && rustc -Zhelp && rustc -Whelp)",
31+
&expected_all,
32+
)
33+
.actual_text("(rustc --help -Chelp -Zhelp -Whelp)", &all_help)
34+
.run();
35+
36+
// Check that the ordering of help options is respected
37+
// Note that this is except for `-Whelp`, which always comes last
38+
let expected_ordered_help = format!("{unstable_help}{codegen_help}{help}{lints_help}");
39+
let ordered_help =
40+
bare_rustc().args(["-Whelp", "-Zhelp", "-Chelp", "--help"]).run().stdout_utf8();
41+
diff()
42+
.expected_text(
43+
"(rustc -Whelp && rustc -Zhelp && rustc -Chelp && rustc --help)",
44+
&expected_ordered_help,
45+
)
46+
.actual_text("(rustc -Whelp -Zhelp -Chelp --help)", &ordered_help)
47+
.run();
2148
}

0 commit comments

Comments
 (0)