Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/uu/base32/src/base_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ pub mod fast_encode {
leftover_buffer.extend(stolen_bytes);

// After appending the stolen bytes to `leftover_buffer`, it should be the right size
assert!(leftover_buffer.len() == encode_in_chunks_of_size);
assert_eq!(leftover_buffer.len(), encode_in_chunks_of_size);

// Encode the old unencoded data and the stolen bytes, and add the result to
// `encoded_buffer`
Expand All @@ -343,7 +343,7 @@ pub mod fast_encode {
let remainder = chunks_exact.remainder();

for sl in chunks_exact {
assert!(sl.len() == encode_in_chunks_of_size);
assert_eq!(sl.len(), encode_in_chunks_of_size);

supports_fast_decode_and_encode.encode_to_vec_deque(sl, encoded_buffer)?;
}
Expand Down Expand Up @@ -622,7 +622,7 @@ pub mod fast_decode {
leftover_buffer.extend(stolen_bytes);

// After appending the stolen bytes to `leftover_buffer`, it should be the right size
assert!(leftover_buffer.len() == decode_in_chunks_of_size);
assert_eq!(leftover_buffer.len(), decode_in_chunks_of_size);

// Decode the old un-decoded data and the stolen bytes, and add the result to
// `decoded_buffer`
Expand All @@ -642,7 +642,7 @@ pub mod fast_decode {
let remainder = chunks_exact.remainder();

for sl in chunks_exact {
assert!(sl.len() == decode_in_chunks_of_size);
assert_eq!(sl.len(), decode_in_chunks_of_size);

supports_fast_decode_and_encode.decode_into_vec(sl, decoded_buffer)?;
}
Expand Down
28 changes: 14 additions & 14 deletions src/uu/dd/src/dd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,8 @@ mod tests {
fn bsize_test_primes() {
let (n, m) = (7901, 7919);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, n * m);
}
Expand All @@ -1450,8 +1450,8 @@ mod tests {
fn bsize_test_rel_prime_obs_greater() {
let (n, m) = (7 * 5119, 13 * 5119);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, 7 * 13 * 5119);
}
Expand All @@ -1460,8 +1460,8 @@ mod tests {
fn bsize_test_rel_prime_ibs_greater() {
let (n, m) = (13 * 5119, 7 * 5119);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, 7 * 13 * 5119);
}
Expand All @@ -1470,8 +1470,8 @@ mod tests {
fn bsize_test_3fac_rel_prime() {
let (n, m) = (11 * 13 * 5119, 7 * 11 * 5119);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, 7 * 11 * 13 * 5119);
}
Expand All @@ -1480,8 +1480,8 @@ mod tests {
fn bsize_test_ibs_greater() {
let (n, m) = (512 * 1024, 256 * 1024);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, n);
}
Expand All @@ -1490,8 +1490,8 @@ mod tests {
fn bsize_test_obs_greater() {
let (n, m) = (256 * 1024, 512 * 1024);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, m);
}
Expand All @@ -1500,8 +1500,8 @@ mod tests {
fn bsize_test_bs_eq() {
let (n, m) = (1024, 1024);
let res = calc_bsize(n, m);
assert!(res % n == 0);
assert!(res % m == 0);
assert_eq!(res % n, 0);
assert_eq!(res % m, 0);

assert_eq!(res, m);
}
Expand Down
2 changes: 1 addition & 1 deletion src/uu/head/src/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ mod tests {
#[test]
fn test_gnu_compatibility() {
let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); // spell-checker:disable-line
assert!(args.mode == Mode::FirstBytes(1024));
assert_eq!(args.mode, Mode::FirstBytes(1024));
assert!(args.verbose);
assert_eq!(options("-5").unwrap().mode, Mode::FirstLines(5));
assert_eq!(options("-2b").unwrap().mode, Mode::FirstBytes(1024));
Expand Down
10 changes: 6 additions & 4 deletions src/uu/numfmt/src/numfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,9 @@ mod tests {
let mut options = get_valid_options();
options.invalid = InvalidModes::Fail;
handle_buffer(BufReader::new(&input_value[..]), &options).unwrap();
assert!(
get_exit_code() == 2,
assert_eq!(
get_exit_code(),
2,
"should set exit code 2 for formatting errors"
);
}
Expand All @@ -502,8 +503,9 @@ mod tests {
let mut options = get_valid_options();
options.invalid = InvalidModes::Fail;
handle_args(input_value, &options).unwrap();
assert!(
get_exit_code() == 2,
assert_eq!(
get_exit_code(),
2,
"should set exit code 2 for formatting errors"
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/uu/paste/src/paste.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fn parse_delimiters(delimiters: &str) -> UResult<Box<[Box<[u8]>]>> {
fn remove_trailing_line_ending_byte(line_ending_byte: u8, output: &mut Vec<u8>) {
if let Some(&byte) = output.last() {
if byte == line_ending_byte {
assert!(output.pop() == Some(line_ending_byte));
assert_eq!(output.pop(), Some(line_ending_byte));
}
}
}
Expand Down Expand Up @@ -326,7 +326,7 @@ impl<'a> DelimiterState<'a> {
} else {
// This branch is NOT unreachable, must be skipped
// `output` should be empty in this case
assert!(output_len == 0);
assert_eq!(output_len, 0);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/uu/shuf/src/rand_read_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ mod test {
let mut rng = ReadRng::new(&v[..]);
rng.fill_bytes(&mut w);

assert!(v == w);
assert_eq!(v, w);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/uucore/src/lib/features/buf_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod tests {
});
let result = copy_stream(&mut pipe_read, &mut dest_file).unwrap();
thread.join().unwrap();
assert!(result == data.len() as u64);
assert_eq!(result, data.len() as u64);

// We would have been at the end already, so seek again to the start.
dest_file.seek(SeekFrom::Start(0)).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/uucore/src/lib/features/proc_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ mod tests {
#[test]
fn test_stat_split() {
let case = "32 (idle_inject/3) S 2 0 0 0 -1 69238848 0 0 0 0 0 0 0 0 -51 0 1 0 34 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 0 0 0 17 3 50 1 0 0 0 0 0 0 0 0 0 0 0";
assert!(stat_split(case)[1] == "idle_inject/3");
assert_eq!(stat_split(case)[1], "idle_inject/3");

let case = "3508 (sh) S 3478 3478 3478 0 -1 4194304 67 0 0 0 0 0 0 0 20 0 1 0 11911 2961408 238 18446744073709551615 94340156948480 94340157028757 140736274114368 0 0 0 0 4096 65538 1 0 0 17 8 0 0 0 0 0 94340157054704 94340157059616 94340163108864 140736274122780 140736274122976 140736274122976 140736274124784 0";
assert!(stat_split(case)[1] == "sh");
assert_eq!(stat_split(case)[1], "sh");

let case = "47246 (kworker /10:1-events) I 2 0 0 0 -1 69238880 0 0 0 0 17 29 0 0 20 0 1 0 1396260 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 0 0 0 17 10 0 0 0 0 0 0 0 0 0 0 0 0 0";
assert!(stat_split(case)[1] == "kworker /10:1-events");
assert_eq!(stat_split(case)[1], "kworker /10:1-events");
}

#[test]
Expand Down
10 changes: 8 additions & 2 deletions tests/by-util/test_chgrp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,14 @@ fn test_traverse_symlinks() {
.arg("dir3/file")
.succeeds();

assert!(at.plus("dir2/file").metadata().unwrap().gid() == first_group.as_raw());
assert!(at.plus("dir3/file").metadata().unwrap().gid() == first_group.as_raw());
assert_eq!(
at.plus("dir2/file").metadata().unwrap().gid(),
first_group.as_raw()
);
assert_eq!(
at.plus("dir3/file").metadata().unwrap().gid(),
first_group.as_raw()
);

ucmd.arg("-R")
.args(args)
Expand Down
13 changes: 6 additions & 7 deletions tests/by-util/test_chmod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ fn run_single_test(test: &TestCase, at: &AtPath, mut ucmd: UCommand) {
make_file(&at.plus_as_string(TEST_FILE), test.before);
let perms = at.metadata(TEST_FILE).permissions().mode();

assert!(
perms == test.before,
assert_eq!(
perms, test.before,
"{}: expected: {:o} got: {perms:o}",
"setting permissions on test files before actual test run failed",
test.after,
"setting permissions on test files before actual test run failed", test.after
);

for arg in &test.args {
Expand All @@ -58,10 +57,10 @@ fn run_single_test(test: &TestCase, at: &AtPath, mut ucmd: UCommand) {
}

let perms = at.metadata(TEST_FILE).permissions().mode();
assert!(
perms == test.after,
assert_eq!(
perms, test.after,
"{ucmd}: expected: {:o} got: {perms:o}",
test.after,
test.after
);
}

Expand Down
5 changes: 3 additions & 2 deletions tests/by-util/test_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,9 @@ mod tests_split_iterator {
);
}
Ok(actual) => {
assert!(
expected == actual.as_slice(),
assert_eq!(
expected,
actual.as_slice(),
"[{i}] After split({input:?}).unwrap()\nexpected: {expected:?}\n actual: {actual:?}\n"
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/by-util/test_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ fn test_install_copy_then_compare_file_with_extra_mode() {
file2_meta = at.metadata(file2);
let after_install_sticky = FileTime::from_last_modification_time(&file2_meta);

assert!(before != after_install_sticky);
assert_ne!(before, after_install_sticky);

sleep(std::time::Duration::from_millis(100));

Expand All @@ -608,7 +608,7 @@ fn test_install_copy_then_compare_file_with_extra_mode() {
file2_meta = at.metadata(file2);
let after_install_sticky_again = FileTime::from_last_modification_time(&file2_meta);

assert!(after_install_sticky != after_install_sticky_again);
assert_ne!(after_install_sticky, after_install_sticky_again);
}

const STRIP_TARGET_FILE: &str = "helloworld_installed";
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn test_shred() {
// File exists
assert!(at.file_exists(file));
// File is obfuscated
assert!(at.read_bytes(file) != file_original_content.as_bytes());
assert_ne!(at.read_bytes(file), file_original_content.as_bytes());
}

#[test]
Expand Down
5 changes: 4 additions & 1 deletion tests/by-util/test_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ fn test_filter_with_env_var_set() {

let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$");
assert_eq!(glob.collate(), at.read_bytes(name));
assert!(env::var("FILE").unwrap_or_else(|_| "var was unset".to_owned()) == env_var_value);
assert_eq!(
env::var("FILE").unwrap_or_else(|_| "var was unset".to_owned()),
env_var_value
);
}

#[test]
Expand Down
6 changes: 3 additions & 3 deletions tests/by-util/test_touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ fn test_touch_set_only_atime() {

let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000");
let (atime, mtime) = get_file_times(&at, file);
assert!(atime != mtime);
assert_ne!(atime, mtime);
assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240);
}
}
Expand Down Expand Up @@ -380,7 +380,7 @@ fn test_touch_set_only_mtime() {

let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000");
let (atime, mtime) = get_file_times(&at, file);
assert!(atime != mtime);
assert_ne!(atime, mtime);
assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240);
}
}
Expand Down Expand Up @@ -805,7 +805,7 @@ fn test_touch_changes_time_of_file_in_stdout() {
.no_stderr();

let (_, mtime_after) = get_file_times(&at, file);
assert!(mtime_after != mtime);
assert_ne!(mtime_after, mtime);
}

#[test]
Expand Down
Loading
Loading