1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-17 04:06:18 +00:00

Merge branch 'master' into refactor_expected_result

This commit is contained in:
Jan Scheer 2021-07-08 00:44:32 +02:00
commit d59cd4fc4a
No known key found for this signature in database
GPG key ID: C62AD4C29E2B9828
11 changed files with 283 additions and 54 deletions

View file

@ -951,3 +951,11 @@ fn test_conflict_check_out() {
);
}
}
#[test]
fn test_key_takes_one_arg() {
new_ucmd!()
.args(&["-k", "2.3", "keys_open_ended.txt"])
.succeeds()
.stdout_is_fixture("keys_open_ended.expected");
}

View file

@ -718,3 +718,21 @@ fn test_bracket_syntax_missing_right_bracket() {
.status_code(2)
.stderr_is("[: missing ']'");
}
#[test]
fn test_bracket_syntax_help() {
let scenario = TestScenario::new("[");
let mut ucmd = scenario.ucmd();
ucmd.arg("--help").succeeds().stdout_contains("USAGE:");
}
#[test]
fn test_bracket_syntax_version() {
let scenario = TestScenario::new("[");
let mut ucmd = scenario.ucmd();
ucmd.arg("--version")
.succeeds()
.stdout_matches(&r"\[ \d+\.\d+\.\d+".parse().unwrap());
}

View file

@ -1,5 +1,10 @@
use crate::common::util::*;
#[test]
fn test_uname() {
new_ucmd!().succeeds();
}
#[test]
fn test_uname_compatible() {
new_ucmd!().arg("-a").succeeds();
@ -45,3 +50,60 @@ fn test_uname_kernel() {
#[cfg(not(target_os = "linux"))]
ucmd.arg("-o").succeeds();
}
#[test]
fn test_uname_operating_system() {
#[cfg(target_vendor = "apple")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("Darwin\n");
#[cfg(target_os = "freebsd")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("FreeBSD\n");
#[cfg(target_os = "fuchsia")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("Fuchsia\n");
#[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "")))]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("GNU/Linux\n");
#[cfg(all(target_os = "linux", not(any(target_env = "gnu", target_env = ""))))]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("Linux\n");
#[cfg(target_os = "netbsd")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("NetBSD\n");
#[cfg(target_os = "openbsd")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("OpenBSD\n");
#[cfg(target_os = "redox")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("Redox\n");
#[cfg(target_os = "windows")]
new_ucmd!()
.arg("--operating-system")
.succeeds()
.stdout_is("Windows NT\n");
}
#[test]
fn test_uname_help() {
new_ucmd!()
.arg("--help")
.succeeds()
.stdout_contains("system information");
}