Skip to content

Commit a9a9fec

Browse files
wflixuclaude
andcommitted
fix: suppress deprecated assert_cmd warnings in CLI tests
- Replace deprecated Command::cargo_bin with helper function - Add #[allow(deprecated)] to suppress warnings - Clean up test code with reusable cargo_bin helper - Maintain test functionality while eliminating warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8129057 commit a9a9fec

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

mdz/src/tests.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
mod tests {
33
use tempfile::TempDir;
44
use predicates::prelude::*;
5+
use assert_cmd::Command;
6+
7+
#[allow(deprecated)]
8+
fn cargo_bin(name: &str) -> Command {
9+
Command::cargo_bin(name).unwrap()
10+
}
511

612
#[test]
713
fn test_cli_help() {
8-
// Build the binary first to ensure it exists
9-
assert_cmd::Command::cargo_bin("mdz")
10-
.unwrap()
14+
cargo_bin("mdz")
1115
.arg("--help")
1216
.assert()
1317
.success()
@@ -17,8 +21,7 @@ mod tests {
1721

1822
#[test]
1923
fn test_cli_version() {
20-
assert_cmd::Command::cargo_bin("mdz")
21-
.unwrap()
24+
cargo_bin("mdz")
2225
.arg("--version")
2326
.assert()
2427
.success()
@@ -28,8 +31,7 @@ mod tests {
2831

2932
#[test]
3033
fn test_cli_pack_help() {
31-
assert_cmd::Command::cargo_bin("mdz")
32-
.unwrap()
34+
cargo_bin("mdz")
3335
.arg("pack")
3436
.arg("--help")
3537
.assert()
@@ -39,8 +41,7 @@ mod tests {
3941

4042
#[test]
4143
fn test_cli_unpack_help() {
42-
assert_cmd::Command::cargo_bin("mdz")
43-
.unwrap()
44+
cargo_bin("mdz")
4445
.arg("unpack")
4546
.arg("--help")
4647
.assert()
@@ -55,8 +56,7 @@ mod tests {
5556

5657
let output_file = temp_path.join("test.mdz");
5758

58-
assert_cmd::Command::cargo_bin("mdz")
59-
.unwrap()
59+
cargo_bin("mdz")
6060
.arg("pack")
6161
.arg("nonexistent.md")
6262
.arg("--output").arg(output_file.to_str().unwrap())
@@ -71,8 +71,7 @@ mod tests {
7171

7272
let output_dir = temp_path.join("output");
7373

74-
assert_cmd::Command::cargo_bin("mdz")
75-
.unwrap()
74+
cargo_bin("mdz")
7675
.arg("unpack")
7776
.arg("nonexistent.mdz")
7877
.arg("--output").arg(output_dir.to_str().unwrap())

0 commit comments

Comments
 (0)