mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
30 lines
640 B
Rust
30 lines
640 B
Rust
use crate::common::util::TestScenario;
|
|
use regex::Regex;
|
|
|
|
#[test]
|
|
fn test_invalid_arg() {
|
|
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
|
}
|
|
|
|
#[test]
|
|
fn test_uptime() {
|
|
TestScenario::new(util_name!())
|
|
.ucmd()
|
|
.succeeds()
|
|
.stdout_contains("load average:")
|
|
.stdout_contains(" up ");
|
|
|
|
// Don't check for users as it doesn't show in some CI
|
|
}
|
|
|
|
#[test]
|
|
fn test_uptime_since() {
|
|
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap();
|
|
|
|
new_ucmd!().arg("--since").succeeds().stdout_matches(&re);
|
|
}
|
|
|
|
#[test]
|
|
fn test_failed() {
|
|
new_ucmd!().arg("will-fail").fails();
|
|
}
|