1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

chore: use assert_eq! and assert_ne! instead of assert!

Makes intent clearer, and if something fails, prints the values that caused the failure as part of the panic message.
This commit is contained in:
Yuri Astrakhan 2025-04-08 13:25:12 -04:00
parent a77e218a79
commit a27880e8a3
16 changed files with 71 additions and 60 deletions

View file

@ -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 {
@ -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
);
}