1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

tests ~ refactor/polish spelling (comments, names, and exceptions)

This commit is contained in:
Roy Ivy III 2021-05-30 00:10:54 -05:00
parent 5c9b474cc8
commit 4e20dedf58
63 changed files with 368 additions and 302 deletions

View file

@ -3,7 +3,7 @@ use uu_factor::numeric;
fn gcd(c: &mut Criterion) { fn gcd(c: &mut Criterion) {
let inputs = { let inputs = {
// Deterministic RNG; use an explicitely-named RNG to guarantee stability // Deterministic RNG; use an explicitly-named RNG to guarantee stability
use rand::{RngCore, SeedableRng}; use rand::{RngCore, SeedableRng};
use rand_chacha::ChaCha8Rng; use rand_chacha::ChaCha8Rng;
const SEED: u64 = 0xa_b4d_1dea_dead_cafe; const SEED: u64 = 0xa_b4d_1dea_dead_cafe;

View file

@ -15,10 +15,10 @@ fn table(c: &mut Criterion) {
CHUNK_SIZE CHUNK_SIZE
); );
let inputs = { let inputs = {
// Deterministic RNG; use an explicitely-named RNG to guarantee stability // Deterministic RNG; use an explicitly-named RNG to guarantee stability
use rand::{RngCore, SeedableRng}; use rand::{RngCore, SeedableRng};
use rand_chacha::ChaCha8Rng; use rand_chacha::ChaCha8Rng;
const SEED: u64 = 0xdead_bebe_ea75_cafe; const SEED: u64 = 0xdead_bebe_ea75_cafe; // spell-checker:disable-line
let mut rng = ChaCha8Rng::seed_from_u64(SEED); let mut rng = ChaCha8Rng::seed_from_u64(SEED);
std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64())) std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64()))

View file

@ -14,14 +14,14 @@ fn test_encode() {
new_ucmd!() new_ucmd!()
.pipe_in(input) .pipe_in(input)
.succeeds() .succeeds()
.stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); // spell-checker:disable-line
// Using '-' as our file // Using '-' as our file
new_ucmd!() new_ucmd!()
.arg("-") .arg("-")
.pipe_in(input) .pipe_in(input)
.succeeds() .succeeds()
.stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); .stdout_only("JBSWY3DPFQQFO33SNRSCC===\n"); // spell-checker:disable-line
} }
#[test] #[test]
@ -29,13 +29,13 @@ fn test_base32_encode_file() {
new_ucmd!() new_ucmd!()
.arg("input-simple.txt") .arg("input-simple.txt")
.succeeds() .succeeds()
.stdout_only("JBSWY3DPFQQFO33SNRSCCCQ=\n"); .stdout_only("JBSWY3DPFQQFO33SNRSCCCQ=\n"); // spell-checker:disable-line
} }
#[test] #[test]
fn test_decode() { fn test_decode() {
for decode_param in &["-d", "--decode"] { for decode_param in &["-d", "--decode"] {
let input = "JBSWY3DPFQQFO33SNRSCC===\n"; let input = "JBSWY3DPFQQFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg(decode_param) .arg(decode_param)
.pipe_in(input) .pipe_in(input)
@ -46,7 +46,7 @@ fn test_decode() {
#[test] #[test]
fn test_garbage() { fn test_garbage() {
let input = "aGVsbG8sIHdvcmxkIQ==\0"; let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-d") .arg("-d")
.pipe_in(input) .pipe_in(input)
@ -57,7 +57,7 @@ fn test_garbage() {
#[test] #[test]
fn test_ignore_garbage() { fn test_ignore_garbage() {
for ignore_garbage_param in &["-i", "--ignore-garbage"] { for ignore_garbage_param in &["-i", "--ignore-garbage"] {
let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-d") .arg("-d")
.arg(ignore_garbage_param) .arg(ignore_garbage_param)
@ -77,7 +77,7 @@ fn test_wrap() {
.pipe_in(input) .pipe_in(input)
.succeeds() .succeeds()
.stdout_only( .stdout_only(
"KRUGKIDROVUWG2ZAMJZG\n653OEBTG66BANJ2W24DT\nEBXXMZLSEB2GQZJANRQX\nU6JAMRXWOLQ=\n", "KRUGKIDROVUWG2ZAMJZG\n653OEBTG66BANJ2W24DT\nEBXXMZLSEB2GQZJANRQX\nU6JAMRXWOLQ=\n", // spell-checker:disable-line
); );
} }
} }

View file

@ -6,14 +6,14 @@ fn test_encode() {
new_ucmd!() new_ucmd!()
.pipe_in(input) .pipe_in(input)
.succeeds() .succeeds()
.stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); // spell-checker:disable-line
// Using '-' as our file // Using '-' as our file
new_ucmd!() new_ucmd!()
.arg("-") .arg("-")
.pipe_in(input) .pipe_in(input)
.succeeds() .succeeds()
.stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); .stdout_only("aGVsbG8sIHdvcmxkIQ==\n"); // spell-checker:disable-line
} }
#[test] #[test]
@ -21,13 +21,13 @@ fn test_base64_encode_file() {
new_ucmd!() new_ucmd!()
.arg("input-simple.txt") .arg("input-simple.txt")
.succeeds() .succeeds()
.stdout_only("SGVsbG8sIFdvcmxkIQo=\n"); .stdout_only("SGVsbG8sIFdvcmxkIQo=\n"); // spell-checker:disable-line
} }
#[test] #[test]
fn test_decode() { fn test_decode() {
for decode_param in &["-d", "--decode"] { for decode_param in &["-d", "--decode"] {
let input = "aGVsbG8sIHdvcmxkIQ=="; let input = "aGVsbG8sIHdvcmxkIQ=="; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg(decode_param) .arg(decode_param)
.pipe_in(input) .pipe_in(input)
@ -38,7 +38,7 @@ fn test_decode() {
#[test] #[test]
fn test_garbage() { fn test_garbage() {
let input = "aGVsbG8sIHdvcmxkIQ==\0"; let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-d") .arg("-d")
.pipe_in(input) .pipe_in(input)
@ -49,7 +49,7 @@ fn test_garbage() {
#[test] #[test]
fn test_ignore_garbage() { fn test_ignore_garbage() {
for ignore_garbage_param in &["-i", "--ignore-garbage"] { for ignore_garbage_param in &["-i", "--ignore-garbage"] {
let input = "aGVsbG8sIHdvcmxkIQ==\0"; let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-d") .arg("-d")
.arg(ignore_garbage_param) .arg(ignore_garbage_param)
@ -68,6 +68,7 @@ fn test_wrap() {
.arg("20") .arg("20")
.pipe_in(input) .pipe_in(input)
.succeeds() .succeeds()
// spell-checker:disable-next-line
.stdout_only("VGhlIHF1aWNrIGJyb3du\nIGZveCBqdW1wcyBvdmVy\nIHRoZSBsYXp5IGRvZy4=\n"); .stdout_only("VGhlIHF1aWNrIGJyb3du\nIGZveCBqdW1wcyBvdmVy\nIHRoZSBsYXp5IGRvZy4=\n");
} }
} }

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) reallylongexecutable
use crate::common::util::*; use crate::common::util::*;
#[cfg(any(unix, target_os = "redox"))] #[cfg(any(unix, target_os = "redox"))]
use std::ffi::OsStr; use std::ffi::OsStr;
@ -50,7 +52,7 @@ fn test_remove_suffix() {
} }
#[test] #[test]
fn test_dont_remove_suffix() { fn test_do_not_remove_suffix() {
new_ucmd!() new_ucmd!()
.args(&["/foo/bar/baz", "baz"]) .args(&["/foo/bar/baz", "baz"])
.succeeds() .succeeds()
@ -64,7 +66,7 @@ fn test_multiple_param() {
new_ucmd!() new_ucmd!()
.args(&[multiple_param, path, path]) .args(&[multiple_param, path, path])
.succeeds() .succeeds()
.stdout_only("baz\nbaz\n"); .stdout_only("baz\nbaz\n"); // spell-checker:disable-line
} }
} }
@ -75,7 +77,7 @@ fn test_suffix_param() {
new_ucmd!() new_ucmd!()
.args(&[suffix_param, ".exe", path, path]) .args(&[suffix_param, ".exe", path, path])
.succeeds() .succeeds()
.stdout_only("baz\nbaz\n"); .stdout_only("baz\nbaz\n"); // spell-checker:disable-line
} }
} }

View file

@ -9,11 +9,12 @@ fn test_output_simple() {
new_ucmd!() new_ucmd!()
.args(&["alpha.txt"]) .args(&["alpha.txt"])
.succeeds() .succeeds()
.stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); .stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line
} }
#[test] #[test]
fn test_no_options() { fn test_no_options() {
// spell-checker:disable-next-line
for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] {
// Give fixture through command line file argument // Give fixture through command line file argument
new_ucmd!() new_ucmd!()
@ -66,8 +67,8 @@ fn test_fifo_symlink() {
assert!(s.fixtures.is_fifo("dir/pipe")); assert!(s.fixtures.is_fifo("dir/pipe"));
// Make cat read the pipe through a symlink // Make cat read the pipe through a symlink
s.fixtures.symlink_file("dir/pipe", "sympipe"); s.fixtures.symlink_file("dir/pipe", "sympipe"); // spell-checker:disable-line
let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); // spell-checker:disable-line
let data = vec_of_size(128 * 1024); let data = vec_of_size(128 * 1024);
let data2 = data.clone(); let data2 = data.clone();
@ -110,7 +111,7 @@ fn test_piped_to_regular_file() {
.succeeds(); .succeeds();
} }
let contents = read_to_string(&file_path).unwrap(); let contents = read_to_string(&file_path).unwrap();
assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line
} }
} }
@ -169,6 +170,7 @@ fn test_directory() {
fn test_directory_and_file() { fn test_directory_and_file() {
let s = TestScenario::new(util_name!()); let s = TestScenario::new(util_name!());
s.fixtures.mkdir("test_directory2"); s.fixtures.mkdir("test_directory2");
// spell-checker:disable-next-line
for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] {
s.ucmd() s.ucmd()
.args(&["test_directory2", fixture]) .args(&["test_directory2", fixture])
@ -190,8 +192,8 @@ fn test_three_directories_and_file_and_stdin() {
"test_directory3/test_directory4", "test_directory3/test_directory4",
"alpha.txt", "alpha.txt",
"-", "-",
"filewhichdoesnotexist.txt", "file_which_does_not_exist.txt",
"nonewline.txt", "nonewline.txt", // spell-checker:disable-line
"test_directory3/test_directory5", "test_directory3/test_directory5",
"test_directory3/../test_directory3/test_directory5", "test_directory3/../test_directory3/test_directory5",
"test_directory3", "test_directory3",
@ -200,12 +202,13 @@ fn test_three_directories_and_file_and_stdin() {
.fails() .fails()
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected") .stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
.stdout_is( .stdout_is(
"abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", "abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", // spell-checker:disable-line
); );
} }
#[test] #[test]
fn test_output_multi_files_print_all_chars() { fn test_output_multi_files_print_all_chars() {
// spell-checker:disable
new_ucmd!() new_ucmd!()
.args(&["alpha.txt", "256.txt", "-A", "-n"]) .args(&["alpha.txt", "256.txt", "-A", "-n"])
.succeeds() .succeeds()
@ -222,10 +225,12 @@ fn test_output_multi_files_print_all_chars() {
M-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-\ M-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-\
pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?", pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?",
); );
// spell-checker:enable
} }
#[test] #[test]
fn test_numbered_lines_no_trailing_newline() { fn test_numbered_lines_no_trailing_newline() {
// spell-checker:disable
new_ucmd!() new_ucmd!()
.args(&["nonewline.txt", "alpha.txt", "-n"]) .args(&["nonewline.txt", "alpha.txt", "-n"])
.succeeds() .succeeds()
@ -233,6 +238,7 @@ fn test_numbered_lines_no_trailing_newline() {
" 1\ttext without a trailing newlineabcde\n 2\tfghij\n \ " 1\ttext without a trailing newlineabcde\n 2\tfghij\n \
3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n", 3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n",
); );
// spell-checker:enable
} }
#[test] #[test]
@ -310,6 +316,7 @@ fn test_stdin_squeeze_blank() {
#[test] #[test]
fn test_stdin_number_non_blank() { fn test_stdin_number_non_blank() {
// spell-checker:disable-next-line
for same_param in &["-b", "--number-nonblank"] { for same_param in &["-b", "--number-nonblank"] {
new_ucmd!() new_ucmd!()
.arg(same_param) .arg(same_param)
@ -322,6 +329,7 @@ fn test_stdin_number_non_blank() {
#[test] #[test]
fn test_non_blank_overrides_number() { fn test_non_blank_overrides_number() {
// spell-checker:disable-next-line
for &same_param in &["-b", "--number-nonblank"] { for &same_param in &["-b", "--number-nonblank"] {
new_ucmd!() new_ucmd!()
.args(&[same_param, "-"]) .args(&[same_param, "-"])

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) nosuchgroup
use crate::common::util::*; use crate::common::util::*;
use rust_users::*; use rust_users::*;

View file

@ -21,7 +21,7 @@ struct TestCase {
after: u32, after: u32,
} }
fn mkfile(file: &str, mode: u32) { fn make_file(file: &str, mode: u32) {
OpenOptions::new() OpenOptions::new()
.mode(mode) .mode(mode)
.create(true) .create(true)
@ -34,7 +34,7 @@ fn mkfile(file: &str, mode: u32) {
} }
fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) { fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) {
mkfile(&at.plus_as_string(TEST_FILE), test.before); make_file(&at.plus_as_string(TEST_FILE), test.before);
let perms = at.metadata(TEST_FILE).permissions().mode(); let perms = at.metadata(TEST_FILE).permissions().mode();
if perms != test.before { if perms != test.before {
panic!( panic!(
@ -123,6 +123,7 @@ fn test_chmod_octal() {
#[test] #[test]
#[allow(clippy::unreadable_literal)] #[allow(clippy::unreadable_literal)]
// spell-checker:disable-next-line
fn test_chmod_ugoa() { fn test_chmod_ugoa() {
let _guard = UMASK_MUTEX.lock(); let _guard = UMASK_MUTEX.lock();
@ -283,7 +284,7 @@ fn test_chmod_reference_file() {
}, },
]; ];
let (at, ucmd) = at_and_ucmd!(); let (at, ucmd) = at_and_ucmd!();
mkfile(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS); make_file(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS);
run_single_test(&tests[0], at, ucmd); run_single_test(&tests[0], at, ucmd);
} }
@ -318,10 +319,10 @@ fn test_chmod_recursive() {
at.mkdir("a/b"); at.mkdir("a/b");
at.mkdir("a/b/c"); at.mkdir("a/b/c");
at.mkdir("z"); at.mkdir("z");
mkfile(&at.plus_as_string("a/a"), 0o100444); make_file(&at.plus_as_string("a/a"), 0o100444);
mkfile(&at.plus_as_string("a/b/b"), 0o100444); make_file(&at.plus_as_string("a/b/b"), 0o100444);
mkfile(&at.plus_as_string("a/b/c/c"), 0o100444); make_file(&at.plus_as_string("a/b/c/c"), 0o100444);
mkfile(&at.plus_as_string("z/y"), 0o100444); make_file(&at.plus_as_string("z/y"), 0o100444);
ucmd.arg("-R") ucmd.arg("-R")
.arg("--verbose") .arg("--verbose")
@ -351,9 +352,9 @@ fn test_chmod_non_existing_file() {
.arg("-R") .arg("-R")
.arg("--verbose") .arg("--verbose")
.arg("-r,a+w") .arg("-r,a+w")
.arg("dont-exist") .arg("does-not-exist")
.fails() .fails()
.stderr_contains(&"cannot access 'dont-exist': No such file or directory"); .stderr_contains(&"cannot access 'does-not-exist': No such file or directory");
} }
#[test] #[test]
@ -432,6 +433,7 @@ fn test_chmod_symlink_non_existing_file_recursive() {
.no_stdout(); .no_stdout();
let expected_stdout = &format!( let expected_stdout = &format!(
// spell-checker:disable-next-line
"mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed", "mode of '{}' retained as 0755 (rwxr-xr-x)\nneither symbolic link '{}/{}' nor referent has been changed",
test_directory, test_directory, test_symlink test_directory, test_directory, test_symlink
); );
@ -473,8 +475,8 @@ fn test_chmod_strip_minus_from_mode() {
("chmod -c -R +w FILE ", "chmod -c -R +w FILE "), ("chmod -c -R +w FILE ", "chmod -c -R +w FILE "),
("chmod a=r,=xX FILE", "chmod a=r,=xX FILE"), ("chmod a=r,=xX FILE", "chmod a=r,=xX FILE"),
( (
"chmod -v --reference RFILE -R FILE", "chmod -v --reference REF_FILE -R FILE",
"chmod -v --reference RFILE -R FILE", "chmod -v --reference REF_FILE -R FILE",
), ),
("chmod -Rvc -w-x FILE", "chmod -Rvc w-x FILE"), ("chmod -Rvc -w-x FILE", "chmod -Rvc w-x FILE"),
("chmod 755 -v FILE", "chmod 755 -v FILE"), ("chmod 755 -v FILE", "chmod 755 -v FILE"),

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) agroupthatdoesntexist auserthatdoesntexist groupname notexisting passgrp
use crate::common::util::*; use crate::common::util::*;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use rust_users::get_effective_uid; use rust_users::get_effective_uid;

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) araba newroot userspec
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) asdf
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
@ -40,7 +42,7 @@ fn test_empty() {
#[test] #[test]
fn test_arg_overrides_stdin() { fn test_arg_overrides_stdin() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let input = "foobarfoobar"; let input = "foobarfoobar"; // spell-checker:disable-line
at.touch("a"); at.touch("a");
@ -78,17 +80,17 @@ fn test_invalid_file() {
} }
// Make sure crc is correct for files larger than 32 bytes // Make sure crc is correct for files larger than 32 bytes
// but <128 bytes (1 fold pclmul) // but <128 bytes (1 fold pclmul) // spell-checker:disable-line
#[test] #[test]
fn test_crc_for_bigger_than_32_bytes() { fn test_crc_for_bigger_than_32_bytes() {
let (_, mut ucmd) = at_and_ucmd!(); let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg("chars.txt").succeeds(); let result = ucmd.arg("chars.txt").succeeds();
let mut stdout_splitted = result.stdout_str().split(' '); let mut stdout_split = result.stdout_str().split(' ');
let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let cksum: i64 = stdout_split.next().unwrap().parse().unwrap();
let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let bytes_cnt: i64 = stdout_split.next().unwrap().parse().unwrap();
assert_eq!(cksum, 586_047_089); assert_eq!(cksum, 586_047_089);
assert_eq!(bytes_cnt, 16); assert_eq!(bytes_cnt, 16);
@ -100,10 +102,10 @@ fn test_stdin_larger_than_128_bytes() {
let result = ucmd.arg("larger_than_2056_bytes.txt").succeeds(); let result = ucmd.arg("larger_than_2056_bytes.txt").succeeds();
let mut stdout_splitted = result.stdout_str().split(' '); let mut stdout_split = result.stdout_str().split(' ');
let cksum: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let cksum: i64 = stdout_split.next().unwrap().parse().unwrap();
let bytes_cnt: i64 = stdout_splitted.next().unwrap().parse().unwrap(); let bytes_cnt: i64 = stdout_split.next().unwrap().parse().unwrap();
assert_eq!(cksum, 945_881_979); assert_eq!(cksum, 945_881_979);
assert_eq!(bytes_cnt, 2058); assert_eq!(bytes_cnt, 2058);

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) defaultcheck nocheck
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
@ -33,19 +35,19 @@ fn ab_dash_three() {
} }
#[test] #[test]
fn aempty() { fn a_empty() {
new_ucmd!() new_ucmd!()
.args(&["a", "empty"]) .args(&["a", "empty"])
.succeeds() .succeeds()
.stdout_only_fixture("aempty.expected"); .stdout_only_fixture("aempty.expected"); // spell-checker:disable-line
} }
#[test] #[test]
fn emptyempty() { fn empty_empty() {
new_ucmd!() new_ucmd!()
.args(&["empty", "empty"]) .args(&["empty", "empty"])
.succeeds() .succeeds()
.stdout_only_fixture("emptyempty.expected"); .stdout_only_fixture("emptyempty.expected"); // spell-checker:disable-line
} }
#[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[cfg_attr(not(feature = "test_unimplemented"), ignore)]
@ -68,8 +70,8 @@ fn output_delimiter_require_arg() {
// even though (info) documentation suggests this is an option // even though (info) documentation suggests this is an option
// in latest GNU Coreutils comm, it actually is not. // in latest GNU Coreutils comm, it actually is not.
// this test is essentially an alarm in case someone well-intendingly // this test is essentially an alarm in case some well-intending
// implements it. // developer implements it.
//marked as unimplemented as error message not set yet. //marked as unimplemented as error message not set yet.
#[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[cfg_attr(not(feature = "test_unimplemented"), ignore)]
#[test] #[test]

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (flags) reflink (fs) tmpfs
use crate::common::util::*; use crate::common::util::*;
#[cfg(not(windows))] #[cfg(not(windows))]
use std::fs::set_permissions; use std::fs::set_permissions;
@ -926,7 +928,7 @@ fn test_cp_archive() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let ts = time::now().to_timespec(); let ts = time::now().to_timespec();
let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32);
// set the file creation/modif an hour ago // set the file creation/modification an hour ago
filetime::set_file_times( filetime::set_file_times(
at.plus_as_string(TEST_HELLO_WORLD_SOURCE), at.plus_as_string(TEST_HELLO_WORLD_SOURCE),
previous, previous,
@ -1055,7 +1057,7 @@ fn test_cp_preserve_timestamps() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let ts = time::now().to_timespec(); let ts = time::now().to_timespec();
let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32);
// set the file creation/modif an hour ago // set the file creation/modification an hour ago
filetime::set_file_times( filetime::set_file_times(
at.plus_as_string(TEST_HELLO_WORLD_SOURCE), at.plus_as_string(TEST_HELLO_WORLD_SOURCE),
previous, previous,
@ -1084,11 +1086,11 @@ fn test_cp_preserve_timestamps() {
#[test] #[test]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
fn test_cp_dont_preserve_timestamps() { fn test_cp_no_preserve_timestamps() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let ts = time::now().to_timespec(); let ts = time::now().to_timespec();
let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32); let previous = FileTime::from_unix_time(ts.sec as i64 - 3600, ts.nsec as u32);
// set the file creation/modif an hour ago // set the file creation/modification an hour ago
filetime::set_file_times( filetime::set_file_times(
at.plus_as_string(TEST_HELLO_WORLD_SOURCE), at.plus_as_string(TEST_HELLO_WORLD_SOURCE),
previous, previous,
@ -1181,7 +1183,7 @@ fn test_cp_one_file_system() {
scene.cmd("umount").arg(mountpoint_path).succeeds(); scene.cmd("umount").arg(mountpoint_path).succeeds();
assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE)); assert!(!at_dst.file_exists(TEST_MOUNT_OTHER_FILESYSTEM_FILE));
// Check if the other files were copied from the source folder hirerarchy // Check if the other files were copied from the source folder hierarchy
for entry in WalkDir::new(at_src.as_string()) { for entry in WalkDir::new(at_src.as_string()) {
let entry = entry.unwrap(); let entry = entry.unwrap();
let relative_src = entry let relative_src = entry

View file

@ -904,7 +904,7 @@ fn test_no_match() {
} }
#[test] #[test]
fn test_too_small_linenum() { fn test_too_small_line_num() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "/20/", "10", "/40/"]) ucmd.args(&["numbers50.txt", "/20/", "10", "/40/"])
.succeeds() .succeeds()
@ -921,7 +921,7 @@ fn test_too_small_linenum() {
} }
#[test] #[test]
fn test_too_small_linenum_equal() { fn test_too_small_line_num_equal() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "/20/", "20"]) ucmd.args(&["numbers50.txt", "/20/", "20"])
.succeeds() .succeeds()
@ -937,7 +937,7 @@ fn test_too_small_linenum_equal() {
} }
#[test] #[test]
fn test_too_small_linenum_elided() { fn test_too_small_line_num_elided() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "-z", "/20/", "10", "/40/"]) ucmd.args(&["numbers50.txt", "-z", "/20/", "10", "/40/"])
.succeeds() .succeeds()
@ -953,7 +953,7 @@ fn test_too_small_linenum_elided() {
} }
#[test] #[test]
fn test_too_small_linenum_negative_offset() { fn test_too_small_line_num_negative_offset() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "/20/-5", "10", "/40/"]) ucmd.args(&["numbers50.txt", "/20/-5", "10", "/40/"])
.succeeds() .succeeds()
@ -970,7 +970,7 @@ fn test_too_small_linenum_negative_offset() {
} }
#[test] #[test]
fn test_too_small_linenum_twice() { fn test_too_small_line_num_twice() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "/20/", "10", "15", "/40/"]) ucmd.args(&["numbers50.txt", "/20/", "10", "15", "/40/"])
.succeeds() .succeeds()
@ -988,7 +988,7 @@ fn test_too_small_linenum_twice() {
} }
#[test] #[test]
fn test_too_small_linenum_repeat() { fn test_too_small_line_num_repeat() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "/20/", "10", "{*}"]) ucmd.args(&["numbers50.txt", "/20/", "10", "{*}"])
.fails() .fails()
@ -1020,7 +1020,7 @@ fn test_too_small_linenum_repeat() {
} }
#[test] #[test]
fn test_linenum_out_of_range1() { fn test_line_num_out_of_range1() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "100"]) ucmd.args(&["numbers50.txt", "100"])
.fails() .fails()
@ -1046,7 +1046,7 @@ fn test_linenum_out_of_range1() {
} }
#[test] #[test]
fn test_linenum_out_of_range2() { fn test_line_num_out_of_range2() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "100"]) ucmd.args(&["numbers50.txt", "10", "100"])
.fails() .fails()
@ -1073,7 +1073,7 @@ fn test_linenum_out_of_range2() {
} }
#[test] #[test]
fn test_linenum_out_of_range3() { fn test_line_num_out_of_range3() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "40", "{2}"]) ucmd.args(&["numbers50.txt", "40", "{2}"])
.fails() .fails()
@ -1100,7 +1100,7 @@ fn test_linenum_out_of_range3() {
} }
#[test] #[test]
fn test_linenum_out_of_range4() { fn test_line_num_out_of_range4() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "40", "{*}"]) ucmd.args(&["numbers50.txt", "40", "{*}"])
.fails() .fails()
@ -1141,7 +1141,7 @@ fn test_skip_to_match_negative_offset_before_a_match() {
} }
#[test] #[test]
fn test_skip_to_match_negative_offset_before_a_linenum() { fn test_skip_to_match_negative_offset_before_a_line_num() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "/20/-10", "15"]) ucmd.args(&["numbers50.txt", "/20/-10", "15"])
.succeeds() .succeeds()
@ -1247,7 +1247,7 @@ fn test_up_to_match_context_underflow() {
// the offset is out of range because of the first pattern // the offset is out of range because of the first pattern
// NOTE: output different than gnu's: the empty split is written but the rest of the input file is not // NOTE: output different than gnu's: the empty split is written but the rest of the input file is not
#[test] #[test]
fn test_linenum_range_with_up_to_match1() { fn test_line_num_range_with_up_to_match1() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "/12/-5"]) ucmd.args(&["numbers50.txt", "10", "/12/-5"])
.fails() .fails()
@ -1277,7 +1277,7 @@ fn test_linenum_range_with_up_to_match1() {
// the offset is out of range because more lines are needed than physically available // the offset is out of range because more lines are needed than physically available
// NOTE: output different than gnu's: the empty split is not written but the rest of the input file is // NOTE: output different than gnu's: the empty split is not written but the rest of the input file is
#[test] #[test]
fn test_linenum_range_with_up_to_match2() { fn test_line_num_range_with_up_to_match2() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "/12/-15"]) ucmd.args(&["numbers50.txt", "10", "/12/-15"])
.fails() .fails()
@ -1306,7 +1306,7 @@ fn test_linenum_range_with_up_to_match2() {
// NOTE: output different than gnu's: the pattern /10/ is matched but should not // NOTE: output different than gnu's: the pattern /10/ is matched but should not
#[test] #[test]
fn test_linenum_range_with_up_to_match3() { fn test_line_num_range_with_up_to_match3() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["numbers50.txt", "10", "/10/", "-k"]) ucmd.args(&["numbers50.txt", "10", "/10/", "-k"])
.fails() .fails()

View file

@ -181,7 +181,7 @@ fn test_date_set_valid_2() {
if get_effective_uid() == 0 { if get_effective_uid() == 0 {
let result = new_ucmd!() let result = new_ucmd!()
.arg("--set") .arg("--set")
.arg("Sat 20 Mar 2021 14:53:01 AWST") .arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line
.fails(); .fails();
result.no_stdout(); result.no_stdout();
assert!(result.stderr_str().starts_with("date: invalid date ")); assert!(result.stderr_str().starts_with("date: invalid date "));

View file

@ -30,14 +30,14 @@ fn test_shell_syntax() {
} }
#[test] #[test]
fn test_strutils() { fn test_str_utils() {
let s = " asd#zcv #hk\t\n "; let s = " asd#zcv #hk\t\n ";
assert_eq!("asd#zcv", s.purify()); assert_eq!("asd#zcv", s.purify());
let s = "con256asd"; let s = "con256asd";
assert!(s.fnmatch("*[2][3-6][5-9]?sd")); assert!(s.fnmatch("*[2][3-6][5-9]?sd")); // spell-checker:disable-line
let s = "zxc \t\nqwe jlk hjl"; let s = "zxc \t\nqwe jlk hjl"; // spell-checker:disable-line
let (k, v) = s.split_two(); let (k, v) = s.split_two();
assert_eq!("zxc", k); assert_eq!("zxc", k);
assert_eq!("qwe jlk hjl", v); assert_eq!("qwe jlk hjl", v);

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (paths) sublink subwords
use crate::common::util::*; use crate::common::util::*;
const SUB_DIR: &str = "subdir/deeper"; const SUB_DIR: &str = "subdir/deeper";

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) araba merci
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
@ -185,9 +187,9 @@ fn test_multiple_hyphen_values() {
#[test] #[test]
fn test_hyphen_values_inside_string() { fn test_hyphen_values_inside_string() {
new_ucmd!() new_ucmd!()
.arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") .arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_contains("CXXFLAGS"); .stdout_contains("CXXFLAGS"); // spell-checker:disable-line
} }
#[test] #[test]

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) bamf chdir
#[cfg(not(windows))] #[cfg(not(windows))]
use std::fs; use std::fs;

View file

@ -6,6 +6,8 @@
// that was distributed with this source code. // that was distributed with this source code.
#![allow(clippy::unreadable_literal)] #![allow(clippy::unreadable_literal)]
// spell-checker:ignore (methods) hexdigest
use crate::common::util::*; use crate::common::util::*;
use std::time::SystemTime; use std::time::SystemTime;
@ -27,13 +29,13 @@ fn test_first_100000_integers() {
extern crate sha1; extern crate sha1;
let n_integers = 100_000; let n_integers = 100_000;
let mut instring = String::new(); let mut input_string = String::new();
for i in 0..=n_integers { for i in 0..=n_integers {
instring.push_str(&(format!("{} ", i))[..]); input_string.push_str(&(format!("{} ", i))[..]);
} }
println!("STDIN='{}'", instring); println!("STDIN='{}'", input_string);
let result = new_ucmd!().pipe_in(instring.as_bytes()).succeeds(); let result = new_ucmd!().pipe_in(input_string.as_bytes()).succeeds();
// `seq 0 100000 | factor | sha1sum` => "4ed2d8403934fa1c76fe4b84c5d4b8850299c359" // `seq 0 100000 | factor | sha1sum` => "4ed2d8403934fa1c76fe4b84c5d4b8850299c359"
let hash_check = sha1::Sha1::from(result.stdout()).hexdigest(); let hash_check = sha1::Sha1::from(result.stdout()).hexdigest();
@ -95,20 +97,20 @@ fn test_random() {
}; };
// build an input and expected output string from factor // build an input and expected output string from factor
let mut instring = String::new(); let mut input_string = String::new();
let mut outstring = String::new(); let mut output_string = String::new();
for _ in 0..NUM_TESTS { for _ in 0..NUM_TESTS {
let (product, factors) = rand_gt(1 << 63); let (product, factors) = rand_gt(1 << 63);
instring.push_str(&(format!("{} ", product))[..]); input_string.push_str(&(format!("{} ", product))[..]);
outstring.push_str(&(format!("{}:", product))[..]); output_string.push_str(&(format!("{}:", product))[..]);
for factor in factors { for factor in factors {
outstring.push_str(&(format!(" {}", factor))[..]); output_string.push_str(&(format!(" {}", factor))[..]);
} }
outstring.push('\n'); output_string.push('\n');
} }
run(instring.as_bytes(), outstring.as_bytes()); run(input_string.as_bytes(), output_string.as_bytes());
} }
#[test] #[test]
@ -120,30 +122,30 @@ fn test_random_big() {
println!("rng_seed={:?}", rng_seed); println!("rng_seed={:?}", rng_seed);
let mut rng = SmallRng::seed_from_u64(rng_seed); let mut rng = SmallRng::seed_from_u64(rng_seed);
let bitrange_1 = Uniform::new(14_usize, 51); let bit_range_1 = Uniform::new(14_usize, 51);
let mut rand_64 = move || { let mut rand_64 = move || {
// first, choose a random number of bits for the first factor // first, choose a random number of bits for the first factor
let f_bit_1 = bitrange_1.sample(&mut rng); let f_bit_1 = bit_range_1.sample(&mut rng);
// how many more bits do we need? // how many more bits do we need?
let rem = 64 - f_bit_1; let rem = 64 - f_bit_1;
// we will have a number of additional factors equal to nfacts + 1 // we will have a number of additional factors equal to n_facts + 1
// where nfacts is in [0, floor(rem/14) ) NOTE half-open interval // where n_facts is in [0, floor(rem/14) ) NOTE half-open interval
// Each prime factor is at least 14 bits, hence floor(rem/14) // Each prime factor is at least 14 bits, hence floor(rem/14)
let nfacts = Uniform::new(0_usize, rem / 14).sample(&mut rng); let n_factors = Uniform::new(0_usize, rem / 14).sample(&mut rng);
// we have to distribute extrabits among the (nfacts + 1) values // we have to distribute extra_bits among the (n_facts + 1) values
let extrabits = rem - (nfacts + 1) * 14; let extra_bits = rem - (n_factors + 1) * 14;
// (remember, a Range is a half-open interval) // (remember, a Range is a half-open interval)
let extrarange = Uniform::new(0_usize, extrabits + 1); let extra_range = Uniform::new(0_usize, extra_bits + 1);
// to generate an even split of this range, generate n-1 random elements // to generate an even split of this range, generate n-1 random elements
// in the range, add the desired total value to the end, sort this list, // in the range, add the desired total value to the end, sort this list,
// and then compute the sequential differences. // and then compute the sequential differences.
let mut f_bits = Vec::new(); let mut f_bits = Vec::new();
for _ in 0..nfacts { for _ in 0..n_factors {
f_bits.push(extrarange.sample(&mut rng)); f_bits.push(extra_range.sample(&mut rng));
} }
f_bits.push(extrabits); f_bits.push(extra_bits);
f_bits.sort_unstable(); f_bits.sort_unstable();
// compute sequential differences here. We leave off the +14 bits // compute sequential differences here. We leave off the +14 bits
@ -160,59 +162,59 @@ fn test_random_big() {
f_bits.push(f_bit_1 - 14); // index of f_bit_1 in PRIMES_BY_BITS f_bits.push(f_bit_1 - 14); // index of f_bit_1 in PRIMES_BY_BITS
let f_bits = f_bits; let f_bits = f_bits;
let mut nbits = 0; let mut n_bits = 0;
let mut product = 1_u64; let mut product = 1_u64;
let mut factors = Vec::new(); let mut factors = Vec::new();
for bit in f_bits { for bit in f_bits {
assert!(bit < 37); assert!(bit < 37);
nbits += 14 + bit; n_bits += 14 + bit;
let elm = Uniform::new(0, PRIMES_BY_BITS[bit].len()).sample(&mut rng); let elm = Uniform::new(0, PRIMES_BY_BITS[bit].len()).sample(&mut rng);
let factor = PRIMES_BY_BITS[bit][elm]; let factor = PRIMES_BY_BITS[bit][elm];
factors.push(factor); factors.push(factor);
product *= factor; product *= factor;
} }
assert_eq!(nbits, 64); assert_eq!(n_bits, 64);
factors.sort_unstable(); factors.sort_unstable();
(product, factors) (product, factors)
}; };
let mut instring = String::new(); let mut input_string = String::new();
let mut outstring = String::new(); let mut output_string = String::new();
for _ in 0..NUM_TESTS { for _ in 0..NUM_TESTS {
let (product, factors) = rand_64(); let (product, factors) = rand_64();
instring.push_str(&(format!("{} ", product))[..]); input_string.push_str(&(format!("{} ", product))[..]);
outstring.push_str(&(format!("{}:", product))[..]); output_string.push_str(&(format!("{}:", product))[..]);
for factor in factors { for factor in factors {
outstring.push_str(&(format!(" {}", factor))[..]); output_string.push_str(&(format!(" {}", factor))[..]);
} }
outstring.push('\n'); output_string.push('\n');
} }
run(instring.as_bytes(), outstring.as_bytes()); run(input_string.as_bytes(), output_string.as_bytes());
} }
#[test] #[test]
fn test_big_primes() { fn test_big_primes() {
let mut instring = String::new(); let mut input_string = String::new();
let mut outstring = String::new(); let mut output_string = String::new();
for prime in PRIMES64 { for prime in PRIMES64 {
instring.push_str(&(format!("{} ", prime))[..]); input_string.push_str(&(format!("{} ", prime))[..]);
outstring.push_str(&(format!("{0}: {0}\n", prime))[..]); output_string.push_str(&(format!("{0}: {0}\n", prime))[..]);
} }
run(instring.as_bytes(), outstring.as_bytes()); run(input_string.as_bytes(), output_string.as_bytes());
} }
fn run(instring: &[u8], outstring: &[u8]) { fn run(input_string: &[u8], output_string: &[u8]) {
println!("STDIN='{}'", String::from_utf8_lossy(instring)); println!("STDIN='{}'", String::from_utf8_lossy(input_string));
println!("STDOUT(expected)='{}'", String::from_utf8_lossy(outstring)); println!("STDOUT(expected)='{}'", String::from_utf8_lossy(output_string));
// now run factor // now run factor
new_ucmd!() new_ucmd!()
.pipe_in(instring) .pipe_in(input_string)
.run() .run()
.stdout_is(String::from_utf8(outstring.to_owned()).unwrap()); .stdout_is(String::from_utf8(output_string.to_owned()).unwrap());
} }
const PRIMES_BY_BITS: &[&[u64]] = &[ const PRIMES_BY_BITS: &[&[u64]] = &[

View file

@ -282,7 +282,7 @@ fn test_backspace_is_not_word_boundary() {
.args(&["-w10", "-s"]) .args(&["-w10", "-s"])
.pipe_in("foobar\x086789abcdef") .pipe_in("foobar\x086789abcdef")
.succeeds() .succeeds()
.stdout_is("foobar\x086789a\nbcdef"); .stdout_is("foobar\x086789a\nbcdef"); // spell-checker:disable-line
} }
#[test] #[test]
@ -291,7 +291,7 @@ fn test_carriage_return_should_be_preserved() {
} }
#[test] #[test]
fn test_carriage_return_overwrriten_char_should_be_preserved() { fn test_carriage_return_overwritten_char_should_be_preserved() {
new_ucmd!().pipe_in("x\ry").succeeds().stdout_is("x\ry"); new_ucmd!().pipe_in("x\ry").succeeds().stdout_is("x\ry");
} }
@ -308,9 +308,9 @@ fn test_carriage_return_should_reset_column_count() {
fn test_carriage_return_is_not_word_boundary() { fn test_carriage_return_is_not_word_boundary() {
new_ucmd!() new_ucmd!()
.args(&["-w6", "-s"]) .args(&["-w6", "-s"])
.pipe_in("fizz\rbuzz\rfizzbuzz") .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_is("fizz\rbuzz\rfizzbu\nzz"); .stdout_is("fizz\rbuzz\rfizzbu\nzz"); // spell-checker:disable-line
} }
// //
@ -496,7 +496,7 @@ fn test_bytewise_backspace_is_not_word_boundary() {
.args(&["-w10", "-s", "-b"]) .args(&["-w10", "-s", "-b"])
.pipe_in("foobar\x0889abcdef") .pipe_in("foobar\x0889abcdef")
.succeeds() .succeeds()
.stdout_is("foobar\x0889a\nbcdef"); .stdout_is("foobar\x0889a\nbcdef"); // spell-checker:disable-line
} }
#[test] #[test]
@ -509,7 +509,7 @@ fn test_bytewise_carriage_return_should_be_preserved() {
} }
#[test] #[test]
fn test_bytewise_carriage_return_overwrriten_char_should_be_preserved() { fn test_bytewise_carriage_return_overwritten_char_should_be_preserved() {
new_ucmd!() new_ucmd!()
.arg("-b") .arg("-b")
.pipe_in("x\ry") .pipe_in("x\ry")
@ -530,9 +530,9 @@ fn test_bytewise_carriage_return_should_not_reset_column_count() {
fn test_bytewise_carriage_return_is_not_word_boundary() { fn test_bytewise_carriage_return_is_not_word_boundary() {
new_ucmd!() new_ucmd!()
.args(&["-w6", "-s", "-b"]) .args(&["-w6", "-s", "-b"])
.pipe_in("fizz\rbuzz\rfizzbuzz") .pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); .stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line
} }
#[test] #[test]
fn test_obsolete_syntax() { fn test_obsolete_syntax() {

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) bogusfile emptyfile
use crate::common::util::*; use crate::common::util::*;
static INPUT: &str = "lorem_ipsum.txt"; static INPUT: &str = "lorem_ipsum.txt";

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) helloworld objdump
use crate::common::util::*; use crate::common::util::*;
use filetime::FileTime; use filetime::FileTime;
use rust_users::*; use rust_users::*;

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) autoformat
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
@ -141,7 +143,7 @@ fn new_line_separated() {
} }
#[test] #[test]
fn multitab_character() { fn tab_multi_character() {
new_ucmd!() new_ucmd!()
.arg("semicolon_fields_1.txt") .arg("semicolon_fields_1.txt")
.arg("semicolon_fields_2.txt") .arg("semicolon_fields_2.txt")

View file

@ -79,9 +79,10 @@ fn test_kill_list_one_signal_from_name() {
#[test] #[test]
fn test_kill_set_bad_signal_name() { fn test_kill_set_bad_signal_name() {
// spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-s") .arg("-s")
.arg("IAMNOTASIGNAL") .arg("IAMNOTASIGNAL") // spell-checker:disable-line
.fails() .fails()
.stderr_contains("unknown signal"); .stderr_contains("unknown signal");
} }

View file

@ -65,10 +65,10 @@ fn test_symlink_circular() {
} }
#[test] #[test]
fn test_symlink_dont_overwrite() { fn test_symlink_do_not_overwrite() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let file = "test_symlink_dont_overwrite"; let file = "test_symlink_do_not_overwrite";
let link = "test_symlink_dont_overwrite_link"; let link = "test_symlink_do_not_overwrite_link";
at.touch(file); at.touch(file);
at.touch(link); at.touch(link);
@ -120,7 +120,7 @@ fn test_symlink_interactive() {
scene scene
.ucmd() .ucmd()
.args(&["-i", "-s", file, link]) .args(&["-i", "-s", file, link])
.pipe_in("Yesh") .pipe_in("Yesh") // spell-checker:disable-line
.succeeds() .succeeds()
.no_stderr(); .no_stderr();

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup somefile somegroup somehiddenbackup somehiddenfile
#[cfg(unix)] #[cfg(unix)]
extern crate unix_socket; extern crate unix_socket;
use crate::common::util::*; use crate::common::util::*;
@ -939,7 +941,7 @@ fn test_ls_color() {
let a_with_colors = "\x1b[1;34ma\x1b[0m"; let a_with_colors = "\x1b[1;34ma\x1b[0m";
let z_with_colors = "\x1b[1;34mz\x1b[0m"; let z_with_colors = "\x1b[1;34mz\x1b[0m";
let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // spell-checker:disable-line
// Color is disabled by default // Color is disabled by default
let result = scene.ucmd().succeeds(); let result = scene.ucmd().succeeds();

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) gpghome
use crate::common::util::*; use crate::common::util::*;
use std::path::PathBuf; use std::path::PathBuf;
@ -8,8 +10,8 @@ static TEST_TEMPLATE2: &str = "temp";
static TEST_TEMPLATE3: &str = "tempX"; static TEST_TEMPLATE3: &str = "tempX";
static TEST_TEMPLATE4: &str = "tempXX"; static TEST_TEMPLATE4: &str = "tempXX";
static TEST_TEMPLATE5: &str = "tempXXX"; static TEST_TEMPLATE5: &str = "tempXXX";
static TEST_TEMPLATE6: &str = "tempXXXlate"; static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line
static TEST_TEMPLATE7: &str = "XXXtemplate"; static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line
#[cfg(unix)] #[cfg(unix)]
static TEST_TEMPLATE8: &str = "tempXXXl/ate"; static TEST_TEMPLATE8: &str = "tempXXXl/ate";
#[cfg(windows)] #[cfg(windows)]

View file

@ -10,7 +10,7 @@ fn test_more_no_arg() {
#[test] #[test]
fn test_more_dir_arg() { fn test_more_dir_arg() {
// Run the test only if there's a valud terminal, else do nothing // Run the test only if there's a valid terminal, else do nothing
// Maybe we could capture the error, i.e. "Device not found" in that case // Maybe we could capture the error, i.e. "Device not found" in that case
// but I am leaving this for later // but I am leaving this for later
if atty::is(atty::Stream::Stdout) { if atty::is(atty::Stream::Stdout) {

View file

@ -171,7 +171,7 @@ fn test_mv_interactive() {
.arg("-i") .arg("-i")
.arg(file_a) .arg(file_a)
.arg(file_b) .arg(file_b)
.pipe_in("Yesh") .pipe_in("Yesh") // spell-checker:disable-line
.succeeds() .succeeds()
.no_stderr(); .no_stderr();

View file

@ -17,7 +17,7 @@ fn test_negative_adjustment() {
let res = new_ucmd!().args(&["-n", "-1", "true"]).run(); let res = new_ucmd!().args(&["-n", "-1", "true"]).run();
assert!(res assert!(res
.stderr_str() .stderr_str()
.starts_with("nice: warning: setpriority: Permission denied")); .starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line
} }
#[test] #[test]

View file

@ -1,7 +1,7 @@
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
fn test_stdin_nonewline() { fn test_stdin_no_newline() {
new_ucmd!() new_ucmd!()
.pipe_in("No Newline") .pipe_in("No Newline")
.run() .run()
@ -41,6 +41,7 @@ fn test_padding_with_overflow() {
#[test] #[test]
fn test_sections_and_styles() { fn test_sections_and_styles() {
// spell-checker:disable
for &(fixture, output) in &[ for &(fixture, output) in &[
( (
"section.txt", "section.txt",
@ -63,4 +64,5 @@ fn test_sections_and_styles() {
.run() .run()
.stdout_is(output); .stdout_is(output);
} }
// spell-checker:enable
} }

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (paths) gnutest
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
@ -231,7 +233,7 @@ fn test_should_skip_leading_space_from_stdin() {
.run() .run()
.stdout_is("2048\n"); .stdout_is("2048\n");
// multiline // multi-line
new_ucmd!() new_ucmd!()
.args(&["--from=auto"]) .args(&["--from=auto"])
.pipe_in("\t1Ki\n 2K") .pipe_in("\t1Ki\n 2K")

View file

@ -8,7 +8,7 @@ use std::fs::File;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
// octal dump of 'abcdefghijklmnopqrstuvwxyz\n' // octal dump of 'abcdefghijklmnopqrstuvwxyz\n' // spell-checker:disable-line
static ALPHA_OUT: &str = " static ALPHA_OUT: &str = "
0000000 061141 062143 063145 064147 065151 066153 067155 070157 0000000 061141 062143 063145 064147 065151 066153 067155 070157
0000020 071161 072163 073165 074167 075171 000012 0000020 071161 072163 073165 074167 075171 000012
@ -16,7 +16,7 @@ static ALPHA_OUT: &str = "
"; ";
// XXX We could do a better job of ensuring that we have a fresh temp dir to ourselves, // 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 proc's leftovers. // not a general one full of other process leftovers.
// Test that od can read one file and dump with default format // Test that od can read one file and dump with default format
#[test] #[test]
@ -29,6 +29,7 @@ fn test_file() {
{ {
let mut f = File::create(&file).unwrap(); let mut f = File::create(&file).unwrap();
// spell-checker:disable-next-line
if f.write_all(b"abcdefghijklmnopqrstuvwxyz\n").is_err() { if f.write_all(b"abcdefghijklmnopqrstuvwxyz\n").is_err() {
panic!("Test setup failed - could not write file"); panic!("Test setup failed - could not write file");
} }
@ -55,6 +56,7 @@ fn test_2files() {
println!("number: {} letter:{}", n, a); println!("number: {} letter:{}", n, a);
} }
// spell-checker:disable-next-line
for &(path, data) in &[(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] { for &(path, data) in &[(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] {
let mut f = File::create(&path).unwrap(); let mut f = File::create(&path).unwrap();
if f.write_all(data.as_bytes()).is_err() { if f.write_all(data.as_bytes()).is_err() {
@ -79,7 +81,7 @@ fn test_2files() {
fn test_no_file() { fn test_no_file() {
let temp = env::temp_dir(); let temp = env::temp_dir();
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
let file = tmpdir.join("}surely'none'would'thus'a'file'name"); let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line
new_ucmd!().arg(file.as_os_str()).fails(); new_ucmd!().arg(file.as_os_str()).fails();
} }
@ -87,7 +89,7 @@ fn test_no_file() {
// Test that od reads from stdin instead of a file // Test that od reads from stdin instead of a file
#[test] #[test]
fn test_from_stdin() { fn test_from_stdin() {
let input = "abcdefghijklmnopqrstuvwxyz\n"; let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.run_piped_stdin(input.as_bytes()) .run_piped_stdin(input.as_bytes())
@ -104,6 +106,7 @@ fn test_from_mixed() {
let file1 = tmpdir.join("test-1"); let file1 = tmpdir.join("test-1");
let file3 = tmpdir.join("test-3"); let file3 = tmpdir.join("test-3");
// spell-checker:disable-next-line
let (data1, data2, data3) = ("abcdefg", "hijklmnop", "qrstuvwxyz\n"); let (data1, data2, data3) = ("abcdefg", "hijklmnop", "qrstuvwxyz\n");
for &(path, data) in &[(&file1, data1), (&file3, data3)] { for &(path, data) in &[(&file1, data1), (&file3, data3)] {
let mut f = File::create(&path).unwrap(); let mut f = File::create(&path).unwrap();
@ -125,7 +128,7 @@ fn test_from_mixed() {
#[test] #[test]
fn test_multiple_formats() { fn test_multiple_formats() {
let input = "abcdefghijklmnopqrstuvwxyz\n"; let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("-b") .arg("-b")
@ -145,6 +148,7 @@ fn test_multiple_formats() {
#[test] #[test]
fn test_dec() { fn test_dec() {
// spell-checker:ignore (words) 0xffu8 xffu
let input = [ let input = [
0u8, 0u8, 1u8, 0u8, 2u8, 0u8, 3u8, 0u8, 0xffu8, 0x7fu8, 0x00u8, 0x80u8, 0x01u8, 0x80u8, 0u8, 0u8, 1u8, 0u8, 2u8, 0u8, 3u8, 0u8, 0xffu8, 0x7fu8, 0x00u8, 0x80u8, 0x01u8, 0x80u8,
]; ];
@ -166,12 +170,14 @@ fn test_dec() {
#[test] #[test]
fn test_hex16() { fn test_hex16() {
let input: [u8; 9] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff]; let input: [u8; 9] = [0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff];
// spell-checker:disable
let expected_output = unindent( let expected_output = unindent(
" "
0000000 2301 6745 ab89 efcd 00ff 0000000 2301 6745 ab89 efcd 00ff
0000011 0000011
", ",
); );
// spell-checker:enable
new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("-x") .arg("-x")
@ -288,7 +294,7 @@ fn test_multibyte() {
new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("-w12") .arg("-w12")
.run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) .run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) // spell-checker:disable-line
.success() .success()
.no_stderr() .no_stderr()
.stdout_is(unindent( .stdout_is(unindent(
@ -487,7 +493,7 @@ fn test_alignment_Fx() {
} }
#[test] #[test]
fn test_maxuint() { fn test_max_uint() {
let input = [0xFFu8; 8]; let input = [0xFFu8; 8];
let expected_output = unindent( let expected_output = unindent(
" "
@ -505,7 +511,7 @@ fn test_maxuint() {
new_ucmd!() new_ucmd!()
.arg("--format=o8") .arg("--format=o8")
.arg("-Oobtu8") .arg("-Oobtu8") // spell-checker:disable-line
.arg("-Dd") .arg("-Dd")
.arg("--format=u1") .arg("--format=u1")
.run_piped_stdin(&input[..]) .run_piped_stdin(&input[..])
@ -583,7 +589,7 @@ fn test_invalid_offset() {
#[test] #[test]
fn test_skip_bytes() { fn test_skip_bytes() {
let input = "abcdefghijklmnopq"; let input = "abcdefghijklmnopq"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("--skip-bytes=5") .arg("--skip-bytes=5")
@ -609,7 +615,7 @@ fn test_skip_bytes_error() {
#[test] #[test]
fn test_read_bytes() { fn test_read_bytes() {
let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("--endian=little") .arg("--endian=little")
.arg("--read-bytes=27") .arg("--read-bytes=27")
@ -626,7 +632,7 @@ fn test_ascii_dump() {
0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff,
]; ];
new_ucmd!() new_ucmd!()
.arg("-tx1zacz") .arg("-tx1zacz") // spell-checker:disable-line
.run_piped_stdin(&input[..]) .run_piped_stdin(&input[..])
.no_stderr() .no_stderr()
.success() .success()
@ -645,7 +651,7 @@ fn test_ascii_dump() {
#[test] #[test]
fn test_filename_parsing() { fn test_filename_parsing() {
// files "a" and "x" both exists, but are no filenames in the commandline below // files "a" and "x" both exists, but are no filenames in the command line below
// "-f" must be treated as a filename, it contains the text: minus lowercase f // "-f" must be treated as a filename, it contains the text: minus lowercase f
// so "-f" should not be interpreted as a formatting option. // so "-f" should not be interpreted as a formatting option.
new_ucmd!() new_ucmd!()
@ -668,7 +674,7 @@ fn test_filename_parsing() {
#[test] #[test]
fn test_stdin_offset() { fn test_stdin_offset() {
let input = "abcdefghijklmnopq"; let input = "abcdefghijklmnopq"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-c") .arg("-c")
.arg("+5") .arg("+5")
@ -703,7 +709,7 @@ fn test_file_offset() {
#[test] #[test]
fn test_traditional() { fn test_traditional() {
// note gnu od does not align both lines // note gnu od does not align both lines
let input = "abcdefghijklmnopq"; let input = "abcdefghijklmnopq"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("-a") .arg("-a")
@ -726,7 +732,7 @@ fn test_traditional() {
#[test] #[test]
fn test_traditional_with_skip_bytes_override() { fn test_traditional_with_skip_bytes_override() {
// --skip-bytes is ignored in this case // --skip-bytes is ignored in this case
let input = "abcdefghijklmnop"; let input = "abcdefghijklmnop"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("--skip-bytes=10") .arg("--skip-bytes=10")
@ -746,7 +752,7 @@ fn test_traditional_with_skip_bytes_override() {
#[test] #[test]
fn test_traditional_with_skip_bytes_non_override() { fn test_traditional_with_skip_bytes_non_override() {
// no offset specified in the traditional way, so --skip-bytes is used // no offset specified in the traditional way, so --skip-bytes is used
let input = "abcdefghijklmnop"; let input = "abcdefghijklmnop"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("--traditional") .arg("--traditional")
.arg("--skip-bytes=10") .arg("--skip-bytes=10")
@ -776,7 +782,7 @@ fn test_traditional_error() {
#[test] #[test]
fn test_traditional_only_label() { fn test_traditional_only_label() {
let input = "abcdefghijklmnopqrstuvwxyz"; let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-An") .arg("-An")
.arg("--traditional") .arg("--traditional")

View file

@ -9,24 +9,24 @@ pub use self::pinky::*;
#[test] #[test]
fn test_capitalize() { fn test_capitalize() {
assert_eq!("Zbnmasd", "zbnmasd".capitalize()); assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line
assert_eq!("Abnmasd", "Abnmasd".capitalize()); assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line
assert_eq!("1masd", "1masd".capitalize()); assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line
assert_eq!("", "".capitalize()); assert_eq!("", "".capitalize());
} }
#[test] #[test]
fn test_long_format() { fn test_long_format() {
let ulogin = "root"; let login = "root";
let pw: Passwd = Passwd::locate(ulogin).unwrap(); let pw: Passwd = Passwd::locate(login).unwrap();
let real_name = pw.user_info().replace("&", &pw.name().capitalize()); let real_name = pw.user_info().replace("&", &pw.name().capitalize());
new_ucmd!() new_ucmd!()
.arg("-l") .arg("-l")
.arg(ulogin) .arg(login)
.succeeds() .succeeds()
.stdout_is(format!( .stdout_is(format!(
"Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n", "Login name: {:<28}In real life: {}\nDirectory: {:<29}Shell: {}\n\n",
ulogin, login,
real_name, real_name,
pw.user_dir(), pw.user_dir(),
pw.user_shell() pw.user_shell()
@ -34,11 +34,11 @@ fn test_long_format() {
new_ucmd!() new_ucmd!()
.arg("-lb") .arg("-lb")
.arg(ulogin) .arg(login)
.succeeds() .succeeds()
.stdout_is(format!( .stdout_is(format!(
"Login name: {:<28}In real life: {1}\n\n", "Login name: {:<28}In real life: {1}\n\n",
ulogin, real_name login, real_name
)); ));
} }

View file

@ -43,12 +43,12 @@ fn escaped_octal() {
} }
#[test] #[test]
fn escaped_unicode_fourdigit() { fn escaped_unicode_four_digit() {
new_ucmd!().args(&["\\u0125"]).succeeds().stdout_only("ĥ"); new_ucmd!().args(&["\\u0125"]).succeeds().stdout_only("ĥ");
} }
#[test] #[test]
fn escaped_unicode_eightdigit() { fn escaped_unicode_eight_digit() {
new_ucmd!() new_ucmd!()
.args(&["\\U00000125"]) .args(&["\\U00000125"])
.succeeds() .succeeds()
@ -77,7 +77,7 @@ fn sub_string() {
} }
#[test] #[test]
fn sub_multifield() { fn sub_multi_field() {
new_ucmd!() new_ucmd!()
.args(&["%s %s", "hello", "world"]) .args(&["%s %s", "hello", "world"])
.succeeds() .succeeds()
@ -85,7 +85,7 @@ fn sub_multifield() {
} }
#[test] #[test]
fn sub_repeat_formatstr() { fn sub_repeat_format_str() {
new_ucmd!() new_ucmd!()
.args(&["%s.", "hello", "world"]) .args(&["%s.", "hello", "world"])
.succeeds() .succeeds()
@ -101,7 +101,7 @@ fn sub_string_ignore_escapes() {
} }
#[test] #[test]
fn sub_bstring_handle_escapes() { fn sub_b_string_handle_escapes() {
new_ucmd!() new_ucmd!()
.args(&["hello %b", "\\tworld"]) .args(&["hello %b", "\\tworld"])
.succeeds() .succeeds()
@ -109,7 +109,7 @@ fn sub_bstring_handle_escapes() {
} }
#[test] #[test]
fn sub_bstring_ignore_subs() { fn sub_b_string_ignore_subs() {
new_ucmd!() new_ucmd!()
.args(&["hello %b", "world %% %i"]) .args(&["hello %b", "world %% %i"])
.succeeds() .succeeds()
@ -133,7 +133,7 @@ fn sub_num_int() {
} }
#[test] #[test]
fn sub_num_int_minwidth() { fn sub_num_int_min_width() {
new_ucmd!() new_ucmd!()
.args(&["twenty is %1i", "20"]) .args(&["twenty is %1i", "20"])
.succeeds() .succeeds()
@ -181,11 +181,11 @@ fn sub_num_int_hex_in_neg() {
} }
#[test] #[test]
fn sub_num_int_charconst_in() { fn sub_num_int_char_const_in() {
new_ucmd!() new_ucmd!()
.args(&["ninetyseven is %i", "'a"]) .args(&["ninety seven is %i", "'a"])
.succeeds() .succeeds()
.stdout_only("ninetyseven is 97"); .stdout_only("ninety seven is 97");
} }
#[test] #[test]
@ -287,7 +287,7 @@ fn sub_num_hex_float_upper() {
} }
#[test] #[test]
fn sub_minwidth() { fn sub_min_width() {
new_ucmd!() new_ucmd!()
.args(&["hello %7s", "world"]) .args(&["hello %7s", "world"])
.succeeds() .succeeds()
@ -295,7 +295,7 @@ fn sub_minwidth() {
} }
#[test] #[test]
fn sub_minwidth_negative() { fn sub_min_width_negative() {
new_ucmd!() new_ucmd!()
.args(&["hello %-7s", "world"]) .args(&["hello %-7s", "world"])
.succeeds() .succeeds()
@ -327,7 +327,7 @@ fn sub_int_leading_zeroes() {
} }
#[test] #[test]
fn sub_int_leading_zeroes_prio() { fn sub_int_leading_zeroes_padded() {
new_ucmd!() new_ucmd!()
.args(&["%5.4i", "11"]) .args(&["%5.4i", "11"])
.succeeds() .succeeds()
@ -359,7 +359,7 @@ fn sub_float_no_octal_in() {
} }
#[test] #[test]
fn sub_any_asterisk_firstparam() { fn sub_any_asterisk_first_param() {
new_ucmd!() new_ucmd!()
.args(&["%*i", "3", "11", "4", "12"]) .args(&["%*i", "3", "11", "4", "12"])
.succeeds() .succeeds()
@ -401,7 +401,7 @@ fn sub_any_asterisk_hex_arg() {
#[test] #[test]
fn sub_any_specifiers_no_params() { fn sub_any_specifiers_no_params() {
new_ucmd!() new_ucmd!()
.args(&["%ztlhLji", "3"]) .args(&["%ztlhLji", "3"]) //spell-checker:disable-line
.succeeds() .succeeds()
.stdout_only("3"); .stdout_only("3");
} }
@ -409,7 +409,7 @@ fn sub_any_specifiers_no_params() {
#[test] #[test]
fn sub_any_specifiers_after_first_param() { fn sub_any_specifiers_after_first_param() {
new_ucmd!() new_ucmd!()
.args(&["%0ztlhLji", "3"]) .args(&["%0ztlhLji", "3"]) //spell-checker:disable-line
.succeeds() .succeeds()
.stdout_only("3"); .stdout_only("3");
} }
@ -417,7 +417,7 @@ fn sub_any_specifiers_after_first_param() {
#[test] #[test]
fn sub_any_specifiers_after_period() { fn sub_any_specifiers_after_period() {
new_ucmd!() new_ucmd!()
.args(&["%0.ztlhLji", "3"]) .args(&["%0.ztlhLji", "3"]) //spell-checker:disable-line
.succeeds() .succeeds()
.stdout_only("3"); .stdout_only("3");
} }
@ -425,7 +425,7 @@ fn sub_any_specifiers_after_period() {
#[test] #[test]
fn sub_any_specifiers_after_second_param() { fn sub_any_specifiers_after_second_param() {
new_ucmd!() new_ucmd!()
.args(&["%0.0ztlhLji", "3"]) .args(&["%0.0ztlhLji", "3"]) //spell-checker:disable-line
.succeeds() .succeeds()
.stdout_only("3"); .stdout_only("3");
} }

View file

@ -1,43 +1,43 @@
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
fn gnu_ext_disabled_roff_no_ref() { fn gnu_ext_disabled_rightward_no_ref() {
new_ucmd!() new_ucmd!()
.args(&["-G", "-R", "input"]) .args(&["-G", "-R", "input"])
.succeeds() .succeeds()
.stdout_only_fixture("gnu_ext_disabled_roff_no_ref.expected"); .stdout_only_fixture("gnu_ext_disabled_rightward_no_ref.expected");
} }
#[test] #[test]
fn gnu_ext_disabled_roff_no_ref_empty_word_regexp() { fn gnu_ext_disabled_rightward_no_ref_empty_word_regexp() {
new_ucmd!() new_ucmd!()
.args(&["-G", "-R", "-W", "", "input"]) .args(&["-G", "-R", "-W", "", "input"])
.succeeds() .succeeds()
.stdout_only_fixture("gnu_ext_disabled_roff_no_ref.expected"); .stdout_only_fixture("gnu_ext_disabled_rightward_no_ref.expected");
} }
#[test] #[test]
fn gnu_ext_disabled_roff_no_ref_word_regexp_exc_space() { fn gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space() {
new_ucmd!() new_ucmd!()
.args(&["-G", "-R", "-W", "[^\t\n]+", "input"]) .args(&["-G", "-R", "-W", "[^\t\n]+", "input"])
.succeeds() .succeeds()
.stdout_only_fixture("gnu_ext_disabled_roff_no_ref_word_regexp_exc_space.expected"); .stdout_only_fixture("gnu_ext_disabled_rightward_no_ref_word_regexp_exc_space.expected");
} }
#[test] #[test]
fn gnu_ext_disabled_roff_input_ref() { fn gnu_ext_disabled_rightward_input_ref() {
new_ucmd!() new_ucmd!()
.args(&["-G", "-r", "-R", "input"]) .args(&["-G", "-r", "-R", "input"])
.succeeds() .succeeds()
.stdout_only_fixture("gnu_ext_disabled_roff_input_ref.expected"); .stdout_only_fixture("gnu_ext_disabled_rightward_input_ref.expected");
} }
#[test] #[test]
fn gnu_ext_disabled_roff_auto_ref() { fn gnu_ext_disabled_rightward_auto_ref() {
new_ucmd!() new_ucmd!()
.args(&["-G", "-A", "-R", "input"]) .args(&["-G", "-A", "-R", "input"])
.succeeds() .succeeds()
.stdout_only_fixture("gnu_ext_disabled_roff_auto_ref.expected"); .stdout_only_fixture("gnu_ext_disabled_rightward_auto_ref.expected");
} }
#[test] #[test]

View file

@ -9,5 +9,5 @@ fn test_default() {
#[test] #[test]
fn test_failed() { fn test_failed() {
let (_at, mut ucmd) = at_and_ucmd!(); let (_at, mut ucmd) = at_and_ucmd!();
ucmd.arg("willfail").fails(); ucmd.arg("will-fail").fails();
} }

View file

@ -115,12 +115,12 @@ fn test_relpath_with_from_with_d() {
#[cfg(not(windows))] #[cfg(not(windows))]
assert!(Path::new(&_result_stdout).is_relative()); assert!(Path::new(&_result_stdout).is_relative());
// d is not part of subpath -> expect absolut path // d is not part of subpath -> expect absolute path
_result_stdout = scene _result_stdout = scene
.ucmd() .ucmd()
.arg(to) .arg(to)
.arg(from) .arg(from)
.arg("-dnon_existing") .arg("-dnon_existing") // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_move_str(); .stdout_move_str();
assert!(Path::new(&_result_stdout).is_absolute()); assert!(Path::new(&_result_stdout).is_absolute());
@ -166,11 +166,11 @@ fn test_relpath_no_from_with_d() {
#[cfg(not(windows))] #[cfg(not(windows))]
assert!(Path::new(&_result_stdout).is_relative()); assert!(Path::new(&_result_stdout).is_relative());
// d is not part of subpath -> expect absolut path // d is not part of subpath -> expect absolute path
let result_stdout = scene let result_stdout = scene
.ucmd() .ucmd()
.arg(to) .arg(to)
.arg("-dnon_existing") .arg("-dnon_existing") // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_move_str(); .stdout_move_str();
assert!(Path::new(&result_stdout).is_absolute()); assert!(Path::new(&result_stdout).is_absolute());

View file

@ -65,7 +65,7 @@ fn test_rm_interactive() {
.arg("-i") .arg("-i")
.arg(file_a) .arg(file_a)
.arg(file_b) .arg(file_b)
.pipe_in("Yesh") .pipe_in("Yesh") // spell-checker:disable-line
.succeeds(); .succeeds();
assert!(!at.file_exists(file_a)); assert!(!at.file_exists(file_a));

View file

@ -19,7 +19,7 @@ fn test_output_is_random_permutation() {
.map(|x| x.parse().unwrap()) .map(|x| x.parse().unwrap())
.collect(); .collect();
result_seq.sort_unstable(); result_seq.sort_unstable();
assert_ne!(result.stdout_str(), input, "Output is not randomised"); assert_ne!(result.stdout_str(), input, "Output is not randomized");
assert_eq!(result_seq, input_seq, "Output is not a permutation"); assert_eq!(result_seq, input_seq, "Output is not a permutation");
} }

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (words) ints
use crate::common::util::*; use crate::common::util::*;
fn test_helper(file_name: &str, possible_args: &[&str]) { fn test_helper(file_name: &str, possible_args: &[&str]) {
@ -61,7 +63,7 @@ fn test_ext_sort_stable() {
} }
#[test] #[test]
fn test_extsort_zero_terminated() { fn test_ext_sort_zero_terminated() {
new_ucmd!() new_ucmd!()
.arg("-z") .arg("-z")
.arg("-S") .arg("-S")
@ -96,7 +98,7 @@ fn test_human_numeric_whitespace() {
// This tests where serde often fails when reading back JSON // This tests where serde often fails when reading back JSON
// if it finds a null value // if it finds a null value
#[test] #[test]
fn test_extsort_as64_bailout() { fn test_ext_sort_as64_bailout() {
new_ucmd!() new_ucmd!()
.arg("-g") .arg("-g")
.arg("-S 5K") .arg("-S 5K")
@ -290,10 +292,10 @@ fn test_dictionary_order() {
fn test_dictionary_order2() { fn test_dictionary_order2() {
for non_dictionary_order2_param in &["-d"] { for non_dictionary_order2_param in &["-d"] {
new_ucmd!() new_ucmd!()
.pipe_in("a👦🏻aa b\naaaa b") .pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line
.arg(non_dictionary_order2_param) .arg(non_dictionary_order2_param) // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_only("a👦🏻aa b\naaaa b\n"); .stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line
} }
} }
@ -301,10 +303,10 @@ fn test_dictionary_order2() {
fn test_non_printing_chars() { fn test_non_printing_chars() {
for non_printing_chars_param in &["-i"] { for non_printing_chars_param in &["-i"] {
new_ucmd!() new_ucmd!()
.pipe_in("a👦🏻aa\naaaa") .pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line
.arg(non_printing_chars_param) .arg(non_printing_chars_param) // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_only("a👦🏻aa\naaaa\n"); .stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line
} }
} }
@ -592,7 +594,7 @@ fn test_keys_ignore_flag() {
} }
#[test] #[test]
fn test_doesnt_inherit_key_settings() { fn test_does_not_inherit_key_settings() {
let input = " 1 let input = " 1
2 2
10 10

View file

@ -242,7 +242,7 @@ fn test_filter() {
.succeeds(); .succeeds();
// assert all characters are 'i' / no character is not 'i' // assert all characters are 'i' / no character is not 'i'
// (assert that command succeded) // (assert that command succeeded)
let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$"); let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$");
assert!( assert!(
glob.collate().iter().find(|&&c| { glob.collate().iter().find(|&&c| {
@ -265,7 +265,7 @@ fn test_filter_with_env_var_set() {
let n_lines = 3; let n_lines = 3;
RandomFile::new(&at, name).add_lines(n_lines); RandomFile::new(&at, name).add_lines(n_lines);
let env_var_value = "somevalue"; let env_var_value = "some-value";
env::set_var("FILE", &env_var_value); env::set_var("FILE", &env_var_value);
ucmd.args(&[format!("--filter={}", "cat > $FILE").as_str(), name]) ucmd.args(&[format!("--filter={}", "cat > $FILE").as_str(), name])
.succeeds(); .succeeds();

View file

@ -6,20 +6,20 @@ extern crate stat;
pub use self::stat::*; pub use self::stat::*;
#[test] #[test]
fn test_scanutil() { fn test_scanners() {
assert_eq!(Some((-5, 2)), "-5zxc".scan_num::<i32>()); assert_eq!(Some((-5, 2)), "-5zxc".scan_num::<i32>());
assert_eq!(Some((51, 2)), "51zxc".scan_num::<u32>()); assert_eq!(Some((51, 2)), "51zxc".scan_num::<u32>());
assert_eq!(Some((192, 4)), "+192zxc".scan_num::<i32>()); assert_eq!(Some((192, 4)), "+192zxc".scan_num::<i32>());
assert_eq!(None, "z192zxc".scan_num::<i32>()); assert_eq!(None, "z192zxc".scan_num::<i32>());
assert_eq!(Some(('a', 3)), "141zxc".scan_char(8)); assert_eq!(Some(('a', 3)), "141zxc".scan_char(8));
assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); // spell-checker:disable-line
assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); // spell-checker:disable-line
assert_eq!(None, "z2qzxc".scan_char(8)); assert_eq!(None, "z2qzxc".scan_char(8)); // spell-checker:disable-line
} }
#[test] #[test]
fn test_groupnum() { fn test_group_num() {
assert_eq!("12,379,821,234", group_num("12379821234")); assert_eq!("12,379,821,234", group_num("12379821234"));
assert_eq!("21,234", group_num("21234")); assert_eq!("21,234", group_num("21234"));
assert_eq!("821,234", group_num("821234")); assert_eq!("821,234", group_num("821234"));
@ -97,13 +97,13 @@ fn test_invalid_option() {
} }
#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[cfg(any(target_os = "linux", target_vendor = "apple"))]
const NORMAL_FMTSTR: &str = const NORMAL_FORMAT_STR: &str =
"%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s %u %U %x %X %y %Y %z %Z"; // avoid "%w %W" (birth/creation) due to `stat` limitations and linux kernel & rust version capability variations "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s %u %U %x %X %y %Y %z %Z"; // avoid "%w %W" (birth/creation) due to `stat` limitations and linux kernel & rust version capability variations
#[cfg(any(target_os = "linux"))] #[cfg(any(target_os = "linux"))]
const DEV_FMTSTR: &str = const DEV_FORMAT_STR: &str =
"%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (%t/%T) %u %U %w %W %x %X %y %Y %z %Z"; "%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s (%t/%T) %u %U %w %W %x %X %y %Y %z %Z";
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
const FS_FMTSTR: &str = "%b %c %i %l %n %s %S %t %T"; // avoid "%a %d %f" which can cause test failure due to race conditions const FS_FORMAT_STR: &str = "%b %c %i %l %n %s %S %t %T"; // avoid "%a %d %f" which can cause test failure due to race conditions
#[test] #[test]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
@ -118,7 +118,7 @@ fn test_terse_fs_format() {
#[test] #[test]
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
fn test_fs_format() { fn test_fs_format() {
let args = ["-f", "-c", FS_FMTSTR, "/dev/shm"]; let args = ["-f", "-c", FS_FORMAT_STR, "/dev/shm"];
new_ucmd!() new_ucmd!()
.args(&args) .args(&args)
.run() .run()
@ -207,7 +207,7 @@ fn test_format_created_seconds() {
#[cfg(any(target_os = "linux", target_vendor = "apple"))] #[cfg(any(target_os = "linux", target_vendor = "apple"))]
#[test] #[test]
fn test_normal_format() { fn test_normal_format() {
let args = ["-c", NORMAL_FMTSTR, "/bin"]; let args = ["-c", NORMAL_FORMAT_STR, "/bin"];
new_ucmd!() new_ucmd!()
.args(&args) .args(&args)
.succeeds() .succeeds()
@ -231,14 +231,14 @@ fn test_symlinks() {
] { ] {
if at.file_exists(file) && at.is_symlink(file) { if at.file_exists(file) && at.is_symlink(file) {
tested = true; tested = true;
let args = ["-c", NORMAL_FMTSTR, file]; let args = ["-c", NORMAL_FORMAT_STR, file];
scene scene
.ucmd() .ucmd()
.args(&args) .args(&args)
.succeeds() .succeeds()
.stdout_is(expected_result(&args)); .stdout_is(expected_result(&args));
// -L, --dereference follow links // -L, --dereference follow links
let args = ["-L", "-c", NORMAL_FMTSTR, file]; let args = ["-L", "-c", NORMAL_FORMAT_STR, file];
scene scene
.ucmd() .ucmd()
.args(&args) .args(&args)
@ -261,7 +261,7 @@ fn test_char() {
let args = [ let args = [
"-c", "-c",
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
DEV_FMTSTR, DEV_FORMAT_STR,
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
"/dev/pts/ptmx", "/dev/pts/ptmx",
#[cfg(any(target_vendor = "apple"))] #[cfg(any(target_vendor = "apple"))]
@ -280,7 +280,7 @@ fn test_char() {
fn test_multi_files() { fn test_multi_files() {
let args = [ let args = [
"-c", "-c",
NORMAL_FMTSTR, NORMAL_FORMAT_STR,
"/dev", "/dev",
"/usr/lib", "/usr/lib",
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]

View file

@ -78,7 +78,7 @@ fn test_follow_multiple() {
at.append(FOOBAR_2_TXT, first_append); at.append(FOOBAR_2_TXT, first_append);
assert_eq!(read_size(&mut child, first_append.len()), first_append); assert_eq!(read_size(&mut child, first_append.len()), first_append);
let second_append = "doce\ntrece\n"; let second_append = "twenty\nthirty\n";
let expected = at.read("foobar_follow_multiple_appended.expected"); let expected = at.read("foobar_follow_multiple_appended.expected");
at.append(FOOBAR_TXT, second_append); at.append(FOOBAR_TXT, second_append);
assert_eq!(read_size(&mut child, expected.len()), expected); assert_eq!(read_size(&mut child, expected.len()), expected);
@ -95,7 +95,7 @@ fn test_follow_stdin() {
.stdout_is_fixture("follow_stdin.expected"); .stdout_is_fixture("follow_stdin.expected");
} }
// FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') This test also breaks tty settings under bash requiring a 'stty sane' or reset. // FixME: test PASSES for usual windows builds, but fails for coverage testing builds (likely related to the specific RUSTFLAGS '-Zpanic_abort_tests -Cpanic=abort') This test also breaks tty settings under bash requiring a 'stty sane' or reset. // spell-checker:disable-line
#[cfg(disable_until_fixed)] #[cfg(disable_until_fixed)]
#[test] #[test]
fn test_follow_with_pid() { fn test_follow_with_pid() {
@ -130,7 +130,7 @@ fn test_follow_with_pid() {
at.append(FOOBAR_2_TXT, first_append); at.append(FOOBAR_2_TXT, first_append);
assert_eq!(read_size(&mut child, first_append.len()), first_append); assert_eq!(read_size(&mut child, first_append.len()), first_append);
let second_append = "doce\ntrece\n"; let second_append = "twenty\nthirty\n";
let expected = at.read("foobar_follow_multiple_appended.expected"); let expected = at.read("foobar_follow_multiple_appended.expected");
at.append(FOOBAR_TXT, second_append); at.append(FOOBAR_TXT, second_append);
assert_eq!(read_size(&mut child, expected.len()), expected); assert_eq!(read_size(&mut child, expected.len()), expected);
@ -268,7 +268,7 @@ fn test_parse_size() {
assert!(parse_size("1Y").is_err()); assert!(parse_size("1Y").is_err());
// Bad number // Bad number
assert!(parse_size("328hdsf3290").is_err()); assert!(parse_size("328hdsf3290").is_err()); // spell-checker:disable-line
} }
#[test] #[test]

View file

@ -8,6 +8,8 @@
// file that was distributed with this source code. // file that was distributed with this source code.
// //
// spell-checker:ignore (words) pseudofloat
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
@ -73,13 +75,13 @@ fn test_negated_or() {
} }
#[test] #[test]
fn test_strlen_of_nothing() { fn test_string_length_of_nothing() {
// odd but matches GNU, which must interpret -n as a literal here // odd but matches GNU, which must interpret -n as a literal here
new_ucmd!().arg("-n").succeeds(); new_ucmd!().arg("-n").succeeds();
} }
#[test] #[test]
fn test_strlen_of_empty() { fn test_string_length_of_empty() {
new_ucmd!().args(&["-n", ""]).run().status_code(1); new_ucmd!().args(&["-n", ""]).run().status_code(1);
// STRING equivalent to -n STRING // STRING equivalent to -n STRING
@ -98,7 +100,7 @@ fn test_zero_len_of_empty() {
} }
#[test] #[test]
fn test_solo_paren_is_literal() { fn test_solo_parenthesis_is_literal() {
let scenario = TestScenario::new(util_name!()); let scenario = TestScenario::new(util_name!());
let tests = [["("], [")"]]; let tests = [["("], [")"]];
@ -167,7 +169,7 @@ fn test_dangling_string_comparison_is_error() {
} }
#[test] #[test]
fn test_stringop_is_literal_after_bang() { fn test_string_operator_is_literal_after_bang() {
let scenario = TestScenario::new(util_name!()); let scenario = TestScenario::new(util_name!());
let tests = [ let tests = [
["!", "="], ["!", "="],
@ -208,7 +210,7 @@ fn test_pseudofloat_not_equal() {
#[test] #[test]
fn test_negative_arg_is_a_string() { fn test_negative_arg_is_a_string() {
new_ucmd!().arg("-12345").succeeds(); new_ucmd!().arg("-12345").succeeds();
new_ucmd!().arg("--qwert").succeeds(); new_ucmd!().arg("--qwert").succeeds(); // spell-checker:disable-line
} }
#[test] #[test]
@ -475,12 +477,12 @@ fn test_nonexistent_file_is_not_symlink() {
} }
#[test] #[test]
fn test_op_prec_and_or_1() { fn test_op_precedence_and_or_1() {
new_ucmd!().args(&[" ", "-o", "", "-a", ""]).succeeds(); new_ucmd!().args(&[" ", "-o", "", "-a", ""]).succeeds();
} }
#[test] #[test]
fn test_op_prec_and_or_1_overridden_by_parentheses() { fn test_op_precedence_and_or_1_overridden_by_parentheses() {
new_ucmd!() new_ucmd!()
.args(&["(", " ", "-o", "", ")", "-a", ""]) .args(&["(", " ", "-o", "", ")", "-a", ""])
.run() .run()
@ -488,14 +490,14 @@ fn test_op_prec_and_or_1_overridden_by_parentheses() {
} }
#[test] #[test]
fn test_op_prec_and_or_2() { fn test_op_precedence_and_or_2() {
new_ucmd!() new_ucmd!()
.args(&["", "-a", "", "-o", " ", "-a", " "]) .args(&["", "-a", "", "-o", " ", "-a", " "])
.succeeds(); .succeeds();
} }
#[test] #[test]
fn test_op_prec_and_or_2_overridden_by_parentheses() { fn test_op_precedence_and_or_2_overridden_by_parentheses() {
new_ucmd!() new_ucmd!()
.args(&["", "-a", "(", "", "-o", " ", ")", "-a", " "]) .args(&["", "-a", "(", "", "-o", " ", ")", "-a", " "])
.run() .run()
@ -529,7 +531,7 @@ fn test_negated_boolean_precedence() {
} }
#[test] #[test]
fn test_bang_boolop_precedence() { fn test_bang_bool_op_precedence() {
// For a Boolean combination of two literals, bang inverts the entire expression // For a Boolean combination of two literals, bang inverts the entire expression
new_ucmd!().args(&["!", "", "-a", ""]).succeeds(); new_ucmd!().args(&["!", "", "-a", ""]).succeeds();
new_ucmd!().args(&["!", "", "-o", ""]).succeeds(); new_ucmd!().args(&["!", "", "-o", ""]).succeeds();
@ -564,7 +566,7 @@ fn test_bang_boolop_precedence() {
} }
#[test] #[test]
fn test_inverted_parenthetical_boolop_precedence() { fn test_inverted_parenthetical_bool_op_precedence() {
// For a Boolean combination of two literals, bang inverts the entire expression // For a Boolean combination of two literals, bang inverts the entire expression
new_ucmd!() new_ucmd!()
.args(&["!", "a value", "-o", "another value"]) .args(&["!", "a value", "-o", "another value"])
@ -618,6 +620,6 @@ fn test_or_as_filename() {
#[test] #[test]
#[ignore = "GNU considers this an error"] #[ignore = "GNU considers this an error"]
fn test_strlen_and_nothing() { fn test_string_length_and_nothing() {
new_ucmd!().args(&["-n", "a", "-a"]).run().status_code(2); new_ucmd!().args(&["-n", "a", "-a"]).run().status_code(2);
} }

View file

@ -4,7 +4,7 @@ use crate::common::util::*;
// the best solution is probably to generate some test binaries that we can call for any // 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) // utility that requires executing another program (kill, for instance)
#[test] #[test]
fn test_subcommand_retcode() { fn test_subcommand_return_code() {
new_ucmd!().arg("1").arg("true").succeeds(); new_ucmd!().arg("1").arg("true").succeeds();
new_ucmd!().arg("1").arg("false").run().status_code(1); new_ucmd!().arg("1").arg("false").run().status_code(1);

View file

@ -1,3 +1,5 @@
// spell-checker:ignore (formats) cymdhm cymdhms mdhm mdhms ymdhm ymdhms
extern crate touch; extern crate touch;
use self::touch::filetime::{self, FileTime}; use self::touch::filetime::{self, FileTime};
@ -383,13 +385,13 @@ fn is_dst_switch_hour(ts: time::Timespec) -> bool {
tm_after.tm_hour == tm.tm_hour + 2 tm_after.tm_hour == tm.tm_hour + 2
} }
// get_dstswitch_hour returns date string for which touch -m -t fails. // get_dst_switch_hour returns date string for which touch -m -t fails.
// For example, in EST (UTC-5), that will be "202003080200" so // For example, in EST (UTC-5), that will be "202003080200" so
// touch -m -t 202003080200 somefile // touch -m -t 202003080200 file
// fails (that date/time does not exist). // fails (that date/time does not exist).
// In other locales it will be a different date/time, and in some locales // In other locales it will be a different date/time, and in some locales
// it doesn't exist at all, in which case this function will return None. // it doesn't exist at all, in which case this function will return None.
fn get_dstswitch_hour() -> Option<String> { fn get_dst_switch_hour() -> Option<String> {
let now = time::now(); let now = time::now();
// Start from January 1, 2020, 00:00. // Start from January 1, 2020, 00:00.
let mut tm = time::strptime("20200101-0000", "%Y%m%d-%H%M").unwrap(); let mut tm = time::strptime("20200101-0000", "%Y%m%d-%H%M").unwrap();
@ -415,7 +417,7 @@ fn test_touch_mtime_dst_fails() {
let (_at, mut ucmd) = at_and_ucmd!(); let (_at, mut ucmd) = at_and_ucmd!();
let file = "test_touch_set_mtime_dst_fails"; let file = "test_touch_set_mtime_dst_fails";
if let Some(s) = get_dstswitch_hour() { if let Some(s) = get_dst_switch_hour() {
ucmd.args(&["-m", "-t", &s, file]).fails(); ucmd.args(&["-m", "-t", &s, file]).fails();
} }
} }

View file

@ -1,7 +1,7 @@
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
fn test_toupper() { fn test_to_upper() {
new_ucmd!() new_ucmd!()
.args(&["a-z", "A-Z"]) .args(&["a-z", "A-Z"])
.pipe_in("!abcd!") .pipe_in("!abcd!")
@ -80,10 +80,10 @@ fn test_complement2() {
#[test] #[test]
fn test_complement3() { fn test_complement3() {
new_ucmd!() new_ucmd!()
.args(&["-c", "abcdefgh", "123"]) .args(&["-c", "abcdefgh", "123"]) // spell-checker:disable-line
.pipe_in("the cat and the bat") .pipe_in("the cat and the bat")
.run() .run()
.stdout_is("3he3ca33a3d33he3ba3"); .stdout_is("3he3ca33a3d33he3ba3"); // spell-checker:disable-line
} }
#[test] #[test]
@ -140,9 +140,9 @@ fn test_translate_and_squeeze() {
fn test_translate_and_squeeze_multiple_lines() { fn test_translate_and_squeeze_multiple_lines() {
new_ucmd!() new_ucmd!()
.args(&["-s", "x", "y"]) .args(&["-s", "x", "y"])
.pipe_in("xxaax\nxaaxx") .pipe_in("xxaax\nxaaxx") // spell-checker:disable-line
.run() .run()
.stdout_is("yaay\nyaay"); .stdout_is("yaay\nyaay"); // spell-checker:disable-line
} }
#[test] #[test]
@ -169,7 +169,7 @@ fn test_set1_longer_than_set2() {
.args(&["abc", "xy"]) .args(&["abc", "xy"])
.pipe_in("abcde") .pipe_in("abcde")
.run() .run()
.stdout_is("xyyde"); .stdout_is("xyyde"); // spell-checker:disable-line
} }
#[test] #[test]
@ -178,7 +178,7 @@ fn test_set1_shorter_than_set2() {
.args(&["ab", "xyz"]) .args(&["ab", "xyz"])
.pipe_in("abcde") .pipe_in("abcde")
.run() .run()
.stdout_is("xycde"); .stdout_is("xycde"); // spell-checker:disable-line
} }
#[test] #[test]
@ -187,7 +187,7 @@ fn test_truncate() {
.args(&["-t", "abc", "xy"]) .args(&["-t", "abc", "xy"])
.pipe_in("abcde") .pipe_in("abcde")
.run() .run()
.stdout_is("xycde"); .stdout_is("xycde"); // spell-checker:disable-line
} }
#[test] #[test]
@ -196,7 +196,7 @@ fn test_truncate_with_set1_shorter_than_set2() {
.args(&["-t", "ab", "xyz"]) .args(&["-t", "ab", "xyz"])
.pipe_in("abcde") .pipe_in("abcde")
.run() .run()
.stdout_is("xycde"); .stdout_is("xycde"); // spell-checker:disable-line
} }
#[test] #[test]
@ -216,8 +216,8 @@ fn missing_required_second_arg_fails() {
#[test] #[test]
fn test_interpret_backslash_escapes() { fn test_interpret_backslash_escapes() {
new_ucmd!() new_ucmd!()
.args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) .args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) // spell-checker:disable-line
.pipe_in("abfnrtv") .pipe_in("abfnrtv") // spell-checker:disable-line
.succeeds() .succeeds()
.stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}"); .stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}");
} }

View file

@ -1,15 +1,15 @@
use crate::common::util::*; use crate::common::util::*;
use std::io::{Seek, SeekFrom, Write}; use std::io::{Seek, SeekFrom, Write};
static TFILE1: &str = "truncate_test_1"; static FILE1: &str = "truncate_test_1";
static TFILE2: &str = "truncate_test_2"; static FILE2: &str = "truncate_test_2";
#[test] #[test]
fn test_increase_file_size() { fn test_increase_file_size() {
let expected = 5 * 1024; let expected = 5 * 1024;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE1); let mut file = at.make_file(FILE1);
ucmd.args(&["-s", "+5K", TFILE1]).succeeds(); ucmd.args(&["-s", "+5K", FILE1]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
@ -25,8 +25,8 @@ fn test_increase_file_size() {
fn test_increase_file_size_kb() { fn test_increase_file_size_kb() {
let expected = 5 * 1000; let expected = 5 * 1000;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE1); let mut file = at.make_file(FILE1);
ucmd.args(&["-s", "+5KB", TFILE1]).succeeds(); ucmd.args(&["-s", "+5KB", FILE1]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
@ -43,15 +43,15 @@ fn test_reference() {
let expected = 5 * 1000; let expected = 5 * 1000;
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());
let at = &scene.fixtures; let at = &scene.fixtures;
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
scene.ucmd().arg("-s").arg("+5KB").arg(TFILE1).run(); scene.ucmd().arg("-s").arg("+5KB").arg(FILE1).run();
scene scene
.ucmd() .ucmd()
.arg("--reference") .arg("--reference")
.arg(TFILE1) .arg(FILE1)
.arg(TFILE2) .arg(FILE2)
.run(); .run();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
@ -68,9 +68,9 @@ fn test_reference() {
fn test_decrease_file_size() { fn test_decrease_file_size() {
let expected = 6; let expected = 6;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size=-4", TFILE2]).succeeds(); ucmd.args(&["--size=-4", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -85,9 +85,9 @@ fn test_decrease_file_size() {
fn test_space_in_size() { fn test_space_in_size() {
let expected = 4; let expected = 4;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", " 4", TFILE2]).succeeds(); ucmd.args(&["--size", " 4", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -106,22 +106,22 @@ fn test_failed() {
#[test] #[test]
fn test_failed_2() { fn test_failed_2() {
let (_at, mut ucmd) = at_and_ucmd!(); let (_at, mut ucmd) = at_and_ucmd!();
ucmd.args(&[TFILE1]).fails(); ucmd.args(&[FILE1]).fails();
} }
#[test] #[test]
fn test_failed_incorrect_arg() { fn test_failed_incorrect_arg() {
let (_at, mut ucmd) = at_and_ucmd!(); let (_at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["-s", "+5A", TFILE1]).fails(); ucmd.args(&["-s", "+5A", FILE1]).fails();
} }
#[test] #[test]
fn test_at_most_shrinks() { fn test_at_most_shrinks() {
let expected = 4; let expected = 4;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", "<4", TFILE2]).succeeds(); ucmd.args(&["--size", "<4", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -136,9 +136,9 @@ fn test_at_most_shrinks() {
fn test_at_most_no_change() { fn test_at_most_no_change() {
let expected = 10; let expected = 10;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", "<40", TFILE2]).succeeds(); ucmd.args(&["--size", "<40", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -153,9 +153,9 @@ fn test_at_most_no_change() {
fn test_at_least_grows() { fn test_at_least_grows() {
let expected = 15; let expected = 15;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", ">15", TFILE2]).succeeds(); ucmd.args(&["--size", ">15", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -170,9 +170,9 @@ fn test_at_least_grows() {
fn test_at_least_no_change() { fn test_at_least_no_change() {
let expected = 10; let expected = 10;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", ">4", TFILE2]).succeeds(); ucmd.args(&["--size", ">4", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -187,9 +187,9 @@ fn test_at_least_no_change() {
fn test_round_down() { fn test_round_down() {
let expected = 8; let expected = 8;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", "/4", TFILE2]).succeeds(); ucmd.args(&["--size", "/4", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -204,9 +204,9 @@ fn test_round_down() {
fn test_round_up() { fn test_round_up() {
let expected = 12; let expected = 12;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE2); let mut file = at.make_file(FILE2);
file.write_all(b"1234567890").unwrap(); file.write_all(b"1234567890").unwrap();
ucmd.args(&["--size", "%4", TFILE2]).succeeds(); ucmd.args(&["--size", "%4", FILE2]).succeeds();
file.seek(SeekFrom::End(0)).unwrap(); file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!( assert!(
@ -221,10 +221,10 @@ fn test_round_up() {
fn test_size_and_reference() { fn test_size_and_reference() {
let expected = 15; let expected = 15;
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
let mut file1 = at.make_file(TFILE1); let mut file1 = at.make_file(FILE1);
let mut file2 = at.make_file(TFILE2); let mut file2 = at.make_file(FILE2);
file1.write_all(b"1234567890").unwrap(); file1.write_all(b"1234567890").unwrap();
ucmd.args(&["--reference", TFILE1, "--size", "+5", TFILE2]) ucmd.args(&["--reference", FILE1, "--size", "+5", FILE2])
.succeeds(); .succeeds();
file2.seek(SeekFrom::End(0)).unwrap(); file2.seek(SeekFrom::End(0)).unwrap();
let actual = file2.seek(SeekFrom::Current(0)).unwrap(); let actual = file2.seek(SeekFrom::Current(0)).unwrap();

View file

@ -17,7 +17,7 @@ fn test_uname_processor() {
} }
#[test] #[test]
fn test_uname_hwplatform() { fn test_uname_hardware_platform() {
let result = new_ucmd!().arg("-i").succeeds(); let result = new_ucmd!().arg("-i").succeeds();
assert_eq!(result.stdout_str().trim_end(), "unknown"); assert_eq!(result.stdout_str().trim_end(), "unknown");
} }

View file

@ -38,7 +38,7 @@ fn unexpand_init_list_1() {
} }
#[test] #[test]
fn unexpand_aflag_0() { fn unexpand_flag_a_0() {
new_ucmd!() new_ucmd!()
.args(&["--"]) .args(&["--"])
.pipe_in("e E\nf F\ng G\nh H\n") .pipe_in("e E\nf F\ng G\nh H\n")
@ -47,7 +47,7 @@ fn unexpand_aflag_0() {
} }
#[test] #[test]
fn unexpand_aflag_1() { fn unexpand_flag_a_1() {
new_ucmd!() new_ucmd!()
.args(&["-a"]) .args(&["-a"])
.pipe_in("e E\nf F\ng G\nh H\n") .pipe_in("e E\nf F\ng G\nh H\n")
@ -56,7 +56,7 @@ fn unexpand_aflag_1() {
} }
#[test] #[test]
fn unexpand_aflag_2() { fn unexpand_flag_a_2() {
new_ucmd!() new_ucmd!()
.args(&["-t8"]) .args(&["-t8"])
.pipe_in("e E\nf F\ng G\nh H\n") .pipe_in("e E\nf F\ng G\nh H\n")

View file

@ -22,5 +22,5 @@ fn test_uptime_since() {
#[test] #[test]
fn test_failed() { fn test_failed() {
new_ucmd!().arg("willfail").fails(); new_ucmd!().arg("will-fail").fails();
} }

View file

@ -1,7 +1,7 @@
use crate::common::util::*; use crate::common::util::*;
#[test] #[test]
fn test_users_noarg() { fn test_users_no_arg() {
new_ucmd!().succeeds(); new_ucmd!().succeeds();
} }

View file

@ -1,5 +1,7 @@
use crate::common::util::*; use crate::common::util::*;
// spell-checker:ignore (flags) lwmcL clmwL ; (path) bogusfile emptyfile manyemptylines moby notrailingnewline onelongemptyline onelongword
#[test] #[test]
fn test_count_bytes_large_stdin() { fn test_count_bytes_large_stdin() {
for &n in &[ for &n in &[

View file

@ -1,5 +1,7 @@
use crate::common::util::*; use crate::common::util::*;
// spell-checker:ignore (flags) runlevel mesg
#[cfg(any(target_vendor = "apple", target_os = "linux"))] #[cfg(any(target_vendor = "apple", target_os = "linux"))]
#[test] #[test]
fn test_count() { fn test_count() {

View file

@ -632,7 +632,7 @@ impl TestScenario {
let tmpd = Rc::new(TempDir::new().unwrap()); let tmpd = Rc::new(TempDir::new().unwrap());
let ts = TestScenario { let ts = TestScenario {
bin_path: { bin_path: {
// Instead of hardcoding the path relative to the current // Instead of hard coding the path relative to the current
// directory, use Cargo's OUT_DIR to find path to executable. // directory, use Cargo's OUT_DIR to find path to executable.
// This allows tests to be run using profiles other than debug. // This allows tests to be run using profiles other than debug.
let target_dir = path_concat!(env!("OUT_DIR"), "..", "..", "..", PROGNAME); let target_dir = path_concat!(env!("OUT_DIR"), "..", "..", "..", PROGNAME);
@ -722,9 +722,10 @@ impl UCommand {
cmd.current_dir(curdir.as_ref()); cmd.current_dir(curdir.as_ref());
if env_clear { if env_clear {
if cfg!(windows) { if cfg!(windows) {
// spell-checker:ignore (dll) rsaenh
// %SYSTEMROOT% is required on Windows to initialize crypto provider // %SYSTEMROOT% is required on Windows to initialize crypto provider
// ... and crypto provider is required for std::rand // ... and crypto provider is required for std::rand
// From procmon: RegQueryValue HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider\Image Path // From `procmon`: RegQueryValue HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider\Image Path
// SUCCESS Type: REG_SZ, Length: 66, Data: %SystemRoot%\system32\rsaenh.dll" // SUCCESS Type: REG_SZ, Length: 66, Data: %SystemRoot%\system32\rsaenh.dll"
for (key, _) in env::vars_os() { for (key, _) in env::vars_os() {
if key.as_os_str() != "SYSTEMROOT" { if key.as_os_str() != "SYSTEMROOT" {
@ -802,7 +803,7 @@ impl UCommand {
self self
} }
/// provides stdinput to feed in to the command when spawned /// provides standard input to feed in to the command when spawned
pub fn pipe_in<T: Into<Vec<u8>>>(&mut self, input: T) -> &mut UCommand { pub fn pipe_in<T: Into<Vec<u8>>>(&mut self, input: T) -> &mut UCommand {
if self.bytes_into_stdin.is_some() { if self.bytes_into_stdin.is_some() {
panic!("{}", MULTIPLE_STDIN_MEANINGLESS); panic!("{}", MULTIPLE_STDIN_MEANINGLESS);
@ -934,6 +935,7 @@ pub fn vec_of_size(n: usize) -> Vec<u8> {
/// Sanity checks for test utils /// Sanity checks for test utils
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
// spell-checker:ignore (tests) asdfsadfa
use super::*; use super::*;
#[test] #[test]
@ -1012,7 +1014,7 @@ mod tests {
} }
#[test] #[test]
fn test_no_std_errout() { fn test_no_stderr_output() {
let res = CmdResult { let res = CmdResult {
tmpd: None, tmpd: None,
code: None, code: None,

View file

@ -1,5 +1,5 @@
cat: test_directory3/test_directory4: Is a directory cat: test_directory3/test_directory4: Is a directory
cat: filewhichdoesnotexist.txt: No such file or directory (os error 2) cat: file_which_does_not_exist.txt: No such file or directory (os error 2)
cat: test_directory3/test_directory5: Is a directory cat: test_directory3/test_directory5: Is a directory
cat: test_directory3/../test_directory3/test_directory5: Is a directory cat: test_directory3/../test_directory3/test_directory5: Is a directory
cat: test_directory3: Is a directory cat: test_directory3: Is a directory

View file

@ -1,4 +1,4 @@
==> foobar.txt <== ==> foobar.txt <==
doce twenty
trece thirty