Use snapshot generated by SNAPSHOTS=overwrite cargo test

This commit is contained in:
Lawrence Chou 2024-06-15 22:43:11 +08:00
parent e5e9f2f7c5
commit 8db30bc4bd
No known key found for this signature in database
GPG key ID: 56B65EC9D482438D

View file

@ -1,6 +1,7 @@
//! Tests for cargo's help output.
use cargo_test_support::registry::Package;
use cargo_test_support::str;
use cargo_test_support::{basic_manifest, cargo_exe, cargo_process, paths, process, project};
use std::fs;
use std::path::Path;
@ -34,7 +35,10 @@ fn help_external_subcommand() {
.publish();
cargo_process("install cargo-fake-help").run();
cargo_process("help fake-help")
.with_stdout_data("fancy help output\n")
.with_stdout_data(str![[r#"
fancy help output
"#]])
.run();
}
@ -140,12 +144,17 @@ fn help_alias() {
// The `empty-alias` returns an error.
cargo_process("help empty-alias")
.env("PATH", Path::new(""))
.with_stderr_data("The subcommand 'empty-alias' wasn't recognized
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] no such command: `empty-alias`
FIXME: #14076 This assertion isn't working, as this line should have caused a test failure but didn't.
",
)
.run_expect_error();
Did you mean `empty-alias`?
View all installed commands with `cargo --list`
Find a package to install `empty-alias` with `cargo search cargo-empty-alias`
"#]])
.run();
// Because `simple-alias` aliases a subcommand with no arguments, help shows the manpage.
help_with_man_and_path("", "simple-alias", "build", Path::new(""));