mirror of
https://github.com/uutils/coreutils
synced 2024-12-12 22:32:53 +00:00
all: add tests for usage error exit code
This commit is contained in:
parent
975a1d170d
commit
9177cb7b24
74 changed files with 371 additions and 0 deletions
|
@ -12,3 +12,8 @@ fn test_arch_help() {
|
|||
.succeeds()
|
||||
.stdout_contains("architecture name");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
|
|
@ -192,3 +192,8 @@ fn test_simple_format() {
|
|||
.code_is(1)
|
||||
.stderr_contains("extra operand 'c'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,11 @@ fn test_invalid_option() {
|
|||
new_ucmd!().arg("-w").arg("/").fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
static DIR: &str = "/dev";
|
||||
|
||||
// we should always get both arguments, regardless of whether --reference was used
|
||||
|
|
|
@ -561,6 +561,11 @@ fn test_no_operands() {
|
|||
.usage_error("missing operand");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mode_after_dash_dash() {
|
||||
let (at, ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -78,6 +78,11 @@ fn test_invalid_option() {
|
|||
new_ucmd!().arg("-w").arg("-q").arg("/").fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_chown_only_owner() {
|
||||
// test chown username file.txt
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(125);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_missing_operand() {
|
||||
let result = new_ucmd!().run();
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_single_file() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ab_no_args() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -7,6 +7,11 @@ fn generate(from: u32, to: u32) -> String {
|
|||
(from..to).fold(String::new(), |acc, v| format!("{}{}\n", acc, v))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -39,6 +39,11 @@ static COMPLEX_SEQUENCE: &TestedSequence = &TestedSequence {
|
|||
sequence: "9-,6-7,-2,4",
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_byte_sequence() {
|
||||
for param in ["-b", "--bytes", "--byt"] {
|
||||
|
|
|
@ -5,6 +5,11 @@ use crate::common::util::*;
|
|||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
use rust_users::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_date_email() {
|
||||
for param in ["--rfc-email", "--rfc-e", "-R"] {
|
||||
|
|
|
@ -75,6 +75,11 @@ fn build_ascii_block(n: usize) -> Vec<u8> {
|
|||
(0..=127).cycle().take(n).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
// Sanity Tests
|
||||
#[test]
|
||||
fn version() {
|
||||
|
|
|
@ -3,6 +3,11 @@ use std::collections::HashSet;
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_df_compatible_no_size_arg() {
|
||||
new_ucmd!().arg("-a").succeeds();
|
||||
|
|
|
@ -4,6 +4,11 @@ use crate::common::util::*;
|
|||
extern crate dircolors;
|
||||
use self::dircolors::{guess_syntax, OutputFmt, StrUtils};
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shell_syntax() {
|
||||
use std::env;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_path_with_trailing_slashes() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -41,6 +41,11 @@ fn _du_basics(s: &str) {
|
|||
assert_eq!(s, answer);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_basics_subdir() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
|
|
|
@ -5,6 +5,11 @@ use std::env;
|
|||
use std::path::Path;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(125);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_env_help() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -2,6 +2,11 @@ use crate::common::util::*;
|
|||
use uucore::display::Quotable;
|
||||
// spell-checker:ignore (ToDO) taaaa tbbbb tcccc
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_with_tab() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -27,6 +27,11 @@ use self::sieve::Sieve;
|
|||
const NUM_PRIMES: usize = 10000;
|
||||
const NUM_TESTS: usize = 100;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parallel() {
|
||||
use hex_literal::hex;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fmt() {
|
||||
let result = new_ucmd!().arg("one-word-per-line.txt").run();
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_80_column_wrap() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -9,6 +9,12 @@ use crate::common::util::*;
|
|||
|
||||
const VERSION_MIN_MULTIPLE_USERS: &str = "8.31"; // this feature was introduced in GNU's coreutils 8.31
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_groups() {
|
||||
|
|
|
@ -116,3 +116,8 @@ fn test_check_sha1() {
|
|||
.stdout_is("testf: OK\n")
|
||||
.stderr_is("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@ use crate::common::util::*;
|
|||
|
||||
static INPUT: &str = "lorem_ipsum.txt";
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin_default() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -28,3 +28,8 @@ fn test_hostname_full() {
|
|||
.succeeds()
|
||||
.stdout_contains(ls_short_res.stdout_str().trim());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@ use crate::common::util::*;
|
|||
|
||||
const VERSION_MIN_MULTIPLE_USERS: &str = "8.31"; // this feature was introduced in GNU's coreutils 8.31
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_id_no_specified_user() {
|
||||
|
|
|
@ -9,6 +9,11 @@ use std::process::Command;
|
|||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use std::thread::sleep;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_install_basic() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -8,6 +8,11 @@ use std::{ffi::OsStr, os::unix::ffi::OsStrExt};
|
|||
#[cfg(windows)]
|
||||
use std::{ffi::OsString, os::windows::ffi::OsStringExt};
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_files() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -45,6 +45,11 @@ impl Drop for Target {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_kill_list_all_signals() {
|
||||
// Check for a few signals. Do not try to be comprehensive.
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
#[test]
|
||||
fn test_link_existing_file() {
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
use crate::common::util::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_symlink_existing_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
use crate::common::util::*;
|
||||
use std::env;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_normal() {
|
||||
let result = new_ucmd!().run();
|
||||
|
|
|
@ -20,6 +20,11 @@ static TEST_DIR11: &str = "mkdir_test11/..";
|
|||
#[cfg(not(windows))]
|
||||
static TEST_DIR12: &str = "mkdir_test12";
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mkdir_mkdir() {
|
||||
new_ucmd!().arg(TEST_DIR1).succeeds();
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_create_fifo_missing_operand() {
|
||||
new_ucmd!().fails().stderr_is("mkfifo: missing operand");
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn test_mknod_help() {
|
||||
|
|
|
@ -4,6 +4,11 @@ extern crate time;
|
|||
use self::filetime::*;
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mv_rename_dir() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin_no_newline() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -5,6 +5,11 @@ use std::thread::sleep;
|
|||
// because stdin/stdout is not attached to a TTY.
|
||||
// All that can be tested is the side-effects.
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(125);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// spell-checker:ignore incorrectnumber
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nproc() {
|
||||
let nproc: u8 = new_ucmd!().succeeds().stdout_str().trim().parse().unwrap();
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_not_round_floats() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -24,6 +24,11 @@ static ALPHA_OUT: &str = "
|
|||
// XXX We could do a better job of ensuring that we have a fresh temp dir to ourselves,
|
||||
// not a general one full of other process leftovers.
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
// Test that od can read one file and dump with default format
|
||||
#[test]
|
||||
fn test_file() {
|
||||
|
|
|
@ -128,6 +128,11 @@ static EXAMPLE_DATA: &[TestData] = &[
|
|||
},
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_combine_pairs_of_lines() {
|
||||
for s in ["-s", "--serial"] {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_mode() {
|
||||
// test the default mode
|
||||
|
|
|
@ -12,6 +12,11 @@ use self::uucore::entries::{Locate, Passwd};
|
|||
extern crate pinky;
|
||||
pub use self::pinky::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_capitalize() {
|
||||
assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gnu_ext_disabled_rightward_no_ref() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -4,6 +4,11 @@ use std::path::PathBuf;
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -8,6 +8,11 @@ static NOT_A_DIRECTORY: &str = "Not a directory";
|
|||
#[cfg(windows)]
|
||||
static NOT_A_DIRECTORY: &str = "The directory name is invalid.";
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rm_one_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -20,6 +20,11 @@ const NOT_A_DIRECTORY: &str = "The directory name is invalid.";
|
|||
#[cfg(not(windows))]
|
||||
const NOT_A_DIRECTORY: &str = "Not a directory";
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rmdir_empty_directory_no_parents() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
use crate::common::util::*;
|
||||
use std::io::Read;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hex_rejects_sign_after_identifier() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shred_remove() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_output_is_random_permutation() {
|
||||
let input_seq = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
|
|
|
@ -119,6 +119,11 @@ impl RandomFile {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_split_default() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -10,6 +10,11 @@ use crate::common::util::*;
|
|||
extern crate stat;
|
||||
pub use self::stat::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scanners() {
|
||||
assert_eq!(Some((-5, 2)), "-5zxc".scan_num::<i32>());
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "Fails because cargo test does not run in a tty"]
|
||||
fn runs() {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bsd_single_file() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -3,6 +3,11 @@ extern crate tempfile;
|
|||
use std::fs;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sync_default() {
|
||||
new_ucmd!().succeeds();
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// spell-checker:ignore axxbxx bxxaxx axxx axxxx xxaxx xxax xxxxa axyz zyax zyxa
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin_default() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -30,6 +30,11 @@ static FOLLOW_NAME_SHORT_EXP: &str = "follow_name_short.expected";
|
|||
#[cfg(target_os = "linux")]
|
||||
static FOLLOW_NAME_EXP: &str = "follow_name.expected";
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(unix, not(target_os = "android")))] // FIXME: fix this test for Android
|
||||
fn test_stdin_default() {
|
||||
|
|
|
@ -6,6 +6,11 @@ use crate::common::util::*;
|
|||
|
||||
// spell-checker:ignore nopipe
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tee_processing_multiple_operands() {
|
||||
// POSIX says: "Processing of at least 13 file operands shall be supported."
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// spell-checker:ignore dont
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(125);
|
||||
}
|
||||
|
||||
// FIXME: this depends on the system having true and false in PATH
|
||||
// the best solution is probably to generate some test binaries that we can call for any
|
||||
// utility that requires executing another program (kill, for instance)
|
||||
|
|
|
@ -59,6 +59,11 @@ fn str_to_filetime(format: &str, s: &str) -> FileTime {
|
|||
FileTime::from_unix_time(offset_dt.unix_timestamp(), tm.nanosecond())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_touch_default() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// spell-checker:ignore aabbaa aabbcc aabc abbb abcc abcdefabcdef abcdefghijk abcdefghijklmn abcdefghijklmnop ABCDEFGHIJKLMNOPQRS abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFZZ abcxyz ABCXYZ abcxyzabcxyz ABCXYZABCXYZ acbdef alnum amzamz AMZXAMZ bbbd cclass cefgm cntrl compl dabcdef dncase Gzabcdefg PQRST upcase wxyzz xdigit xycde xyyye xyyz xyzzzzxyzzzz ZABCDEF Zamz Cdefghijkl Cdefghijklmn
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_upper() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
#[test]
|
||||
fn test_sort_call_graph() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uname() {
|
||||
new_ucmd!().succeeds();
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unexpand_init_0() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -9,6 +9,11 @@ static SKIP_CHARS: &str = "skip-chars.txt";
|
|||
static SKIP_FIELDS: &str = "skip-fields.txt";
|
||||
static SORTED_ZERO_TERMINATED: &str = "sorted-zero-terminated.txt";
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin_default() {
|
||||
new_ucmd!()
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unlink_file() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
|
@ -2,6 +2,11 @@ extern crate regex;
|
|||
use self::regex::Regex;
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uptime() {
|
||||
TestScenario::new(util_name!())
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_users_no_arg() {
|
||||
new_ucmd!().succeeds();
|
||||
|
|
|
@ -2,6 +2,11 @@ use crate::common::util::*;
|
|||
|
||||
// spell-checker:ignore (flags) lwmcL clmwL ; (path) bogusfile emptyfile manyemptylines moby notrailingnewline onelongemptyline onelongword weirdchars
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_count_bytes_large_stdin() {
|
||||
for n in [
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
#[ignore = "issue #3219"]
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_normal() {
|
||||
|
|
|
@ -28,6 +28,11 @@ fn run(args: &[&str], expected: &[u8]) {
|
|||
assert_eq!(buf.as_slice(), expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
run(&[], b"y\ny\ny\ny\n");
|
||||
|
|
Loading…
Reference in a new issue