Skip to content

Commit 02fa19e

Browse files
committed
time: Add smoke test
1 parent a452351 commit 02fa19e

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

datetime/tests/time/mod.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212
process::{Command, Output, Stdio},
1313
};
1414

15-
use plib::TestPlan;
15+
use plib::testing::TestPlan;
1616

1717
fn run_test_base(cmd: &str, args: &Vec<String>, stdin_data: &[u8]) -> Output {
1818
let relpath = if cfg!(debug_assertions) {
@@ -67,11 +67,36 @@ fn run_test_time(
6767
expected_exit_code,
6868
});
6969

70+
let stdout = String::from_utf8_lossy(&output.stdout);
7071
let stderr = String::from_utf8_lossy(&output.stderr);
7172

73+
assert_eq!(stdout, expected_output);
7274
assert!(stderr.contains(expected_error));
7375
}
7476

77+
#[test]
78+
fn test_smoke_help() {
79+
run_test_time(
80+
&["--help"],
81+
"\
82+
time - time a simple command or give resource usage
83+
84+
Usage: time [OPTIONS] <UTILITY> [ARGUMENT]...
85+
86+
Arguments:
87+
<UTILITY> The utility to be invoked
88+
[ARGUMENT]... Arguments for the utility
89+
90+
Options:
91+
-p, --posix Write timing output to standard error in POSIX format
92+
-h, --help Print help
93+
-V, --version Print version
94+
",
95+
"",
96+
0,
97+
);
98+
}
99+
75100
#[test]
76101
fn simple_test() {
77102
run_test_time(&["--", "ls", "-l"], "", "User time", 0);

0 commit comments

Comments
 (0)