Skip to content

Commit 105839f

Browse files
author
Mingshen Sun
committed
tests: use assert_cmd and predicates instead of assert_cli
The assert_cli is said to be deprecated: assert-rs/assert_cli#41
1 parent a4d6e33 commit 105839f

File tree

8 files changed

+307
-259
lines changed

8 files changed

+307
-259
lines changed

Cargo.lock

Lines changed: 87 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ rustyline = { git = "https://github.com/kkawakam/rustyline", optional = true }
8484
tempfile = "3.0.2"
8585
libc = "0.2.40"
8686
lazy_static = "1.0.1"
87-
assert_cli = "0.6.2"
87+
assert_cmd = "0.5.0"
88+
predicates = "0.5.1"
8889

8990
[profile.release]
9091
lto = true

tests/gnu/test_arch.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@
66
// For a copy, see the LICENSE file.
77
//
88

9-
use assert_cli;
9+
use std::process::Command;
10+
use assert_cmd::prelude::*;
1011

1112
#[test]
1213
#[cfg(target_arch = "x86_64")]
1314
fn test_x86_64() {
14-
new_cli!()
15-
.succeeds()
16-
.and()
17-
.stdout().is("x86_64\n")
18-
.unwrap();
15+
new_cmd!()
16+
.assert()
17+
.success()
18+
.stdout("x86_64\n")
19+
.stderr("");
1920
}
2021

2122
#[test]
2223
#[cfg(target_arch = "arm")]
2324
fn test_arm() {
24-
new_cli!()
25-
.succeeds()
26-
.and()
27-
.stdout().is("arm\n")
28-
.unwrap();
25+
new_cmd!()
26+
.assert()
27+
.success()
28+
.stdout("arm\n")
29+
.stderr("");
2930
}
3031

3132
#[test]
3233
#[cfg(target_arch = "aarch64")]
3334
fn test_aarch64() {
34-
new_cli!()
35-
.succeeds()
36-
.and()
37-
.stdout().is("aarch64\n")
38-
.unwrap();
35+
new_cmd!()
36+
.assert()
37+
.success()
38+
.stdout("aarch64\n")
39+
.stderr("");
3940
}

0 commit comments

Comments
 (0)