mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37: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:
parent
a77e218a79
commit
a27880e8a3
16 changed files with 71 additions and 60 deletions
|
@ -23,7 +23,7 @@ fn test_increase_file_size() {
|
|||
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -35,7 +35,7 @@ fn test_increase_file_size_kb() {
|
|||
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -57,7 +57,7 @@ fn test_reference() {
|
|||
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -69,7 +69,7 @@ fn test_decrease_file_size() {
|
|||
ucmd.args(&["--size=-4", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -81,7 +81,7 @@ fn test_space_in_size() {
|
|||
ucmd.args(&["--size", " 4", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -110,7 +110,7 @@ fn test_at_most_shrinks() {
|
|||
ucmd.args(&["--size", "<4", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -122,7 +122,7 @@ fn test_at_most_no_change() {
|
|||
ucmd.args(&["--size", "<40", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -134,7 +134,7 @@ fn test_at_least_grows() {
|
|||
ucmd.args(&["--size", ">15", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -146,7 +146,7 @@ fn test_at_least_no_change() {
|
|||
ucmd.args(&["--size", ">4", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -158,7 +158,7 @@ fn test_round_down() {
|
|||
ucmd.args(&["--size", "/4", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -170,7 +170,7 @@ fn test_round_up() {
|
|||
ucmd.args(&["--size", "%4", FILE2]).succeeds();
|
||||
file.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -184,7 +184,7 @@ fn test_size_and_reference() {
|
|||
.succeeds();
|
||||
file2.seek(SeekFrom::End(0)).unwrap();
|
||||
let actual = file2.stream_position().unwrap();
|
||||
assert!(expected == actual, "expected '{expected}' got '{actual}'");
|
||||
assert_eq!(expected, actual, "expected '{expected}' got '{actual}'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue