mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Clippy fixes in multiple crates
This commit is contained in:
parent
2e8945ba7f
commit
b42168e9dc
5 changed files with 24 additions and 31 deletions
|
@ -807,15 +807,16 @@ mod tests {
|
|||
#[test]
|
||||
fn test_parse_bytes_with_opt_multiplier() {
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123").unwrap(), 123);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123c").unwrap(), 123 * 1);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123c").unwrap(), 123); // 123 * 1
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123w").unwrap(), 123 * 2);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123b").unwrap(), 123 * 512);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123x3").unwrap(), 123 * 3);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("123k").unwrap(), 123 * 1024);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("1x2x3").unwrap(), 1 * 2 * 3);
|
||||
assert_eq!(parse_bytes_with_opt_multiplier("1x2x3").unwrap(), 6); // 1 * 2 * 3
|
||||
|
||||
assert_eq!(
|
||||
parse_bytes_with_opt_multiplier("1wx2cx3w").unwrap(),
|
||||
(1 * 2) * (2 * 1) * (3 * 2)
|
||||
2 * 2 * (3 * 2) // (1 * 2) * (2 * 1) * (3 * 2)
|
||||
);
|
||||
assert!(parse_bytes_with_opt_multiplier("123asdf").is_err());
|
||||
}
|
||||
|
|
|
@ -577,7 +577,7 @@ mod tests {
|
|||
inodes_usage: Some(0.2),
|
||||
};
|
||||
assert_eq!(
|
||||
DisplayRow::new(row, &options).to_string(),
|
||||
DisplayRow::new(&row, &options).to_string(),
|
||||
"my_device 100 25 75 26% my_mount "
|
||||
);
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ mod tests {
|
|||
fn num(n: usize) -> Number {
|
||||
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16));
|
||||
for _ in 0..n {
|
||||
number.increment().unwrap()
|
||||
number.increment().unwrap();
|
||||
}
|
||||
number
|
||||
}
|
||||
|
|
|
@ -338,24 +338,20 @@ fn test_dictionary_order() {
|
|||
|
||||
#[test]
|
||||
fn test_dictionary_order2() {
|
||||
for non_dictionary_order2_param in &["-d"] {
|
||||
new_ucmd!()
|
||||
.pipe_in("a👦🏻aa\tb\naaaa\tb") // spell-checker:disable-line
|
||||
.arg(non_dictionary_order2_param) // spell-checker:disable-line
|
||||
.succeeds()
|
||||
.stdout_only("a👦🏻aa\tb\naaaa\tb\n"); // spell-checker:disable-line
|
||||
}
|
||||
new_ucmd!()
|
||||
.pipe_in("a👦🏻aa\tb\naaaa\tb") // spell-checker:disable-line
|
||||
.arg("-d")
|
||||
.succeeds()
|
||||
.stdout_only("a👦🏻aa\tb\naaaa\tb\n"); // spell-checker:disable-line
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_non_printing_chars() {
|
||||
for non_printing_chars_param in &["-i"] {
|
||||
new_ucmd!()
|
||||
.pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line
|
||||
.arg(non_printing_chars_param) // spell-checker:disable-line
|
||||
.succeeds()
|
||||
.stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line
|
||||
}
|
||||
new_ucmd!()
|
||||
.pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line
|
||||
.arg("-i")
|
||||
.succeeds()
|
||||
.stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -486,14 +482,12 @@ fn test_default_unsorted_ints2() {
|
|||
|
||||
#[test]
|
||||
fn test_numeric_unique_ints2() {
|
||||
for numeric_unique_sort_param in &["-nu"] {
|
||||
let input = "9\n9\n8\n1\n";
|
||||
new_ucmd!()
|
||||
.arg(numeric_unique_sort_param)
|
||||
.pipe_in(input)
|
||||
.succeeds()
|
||||
.stdout_only("1\n8\n9\n");
|
||||
}
|
||||
let input = "9\n9\n8\n1\n";
|
||||
new_ucmd!()
|
||||
.arg("-nu")
|
||||
.pipe_in(input)
|
||||
.succeeds()
|
||||
.stdout_only("1\n8\n9\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -69,10 +69,8 @@ fn test_login() {
|
|||
#[test]
|
||||
fn test_m() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
for opt in &["-m"] {
|
||||
let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
|
||||
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
|
||||
}
|
||||
let expected_stdout = unwrap_or_return!(expected_result(&ts, &["-m"])).stdout_move_str();
|
||||
ts.ucmd().arg("-m").succeeds().stdout_is(expected_stdout);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue