mirror of
https://github.com/uutils/coreutils
synced 2024-12-15 15:52:42 +00:00
Merge pull request #5401 from cakebaker/clippy_suppress_cognitive_complexity_warning
clippy: suppress cognitive_complexity lint in some tests
This commit is contained in:
commit
3cd5f9d175
15 changed files with 21 additions and 0 deletions
|
@ -664,6 +664,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn input_splitter() {
|
fn input_splitter() {
|
||||||
let input = vec![
|
let input = vec![
|
||||||
Ok(String::from("aaa")),
|
Ok(String::from("aaa")),
|
||||||
|
@ -736,6 +737,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn input_splitter_interrupt_rewind() {
|
fn input_splitter_interrupt_rewind() {
|
||||||
let input = vec![
|
let input = vec![
|
||||||
Ok(String::from("aaa")),
|
Ok(String::from("aaa")),
|
||||||
|
|
|
@ -211,6 +211,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn up_to_match_pattern() {
|
fn up_to_match_pattern() {
|
||||||
let input: Vec<String> = vec![
|
let input: Vec<String> = vec![
|
||||||
"/test1.*end$/",
|
"/test1.*end$/",
|
||||||
|
@ -264,6 +265,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn skip_to_match_pattern() {
|
fn skip_to_match_pattern() {
|
||||||
let input: Vec<String> = vec![
|
let input: Vec<String> = vec![
|
||||||
"%test1.*end$%",
|
"%test1.*end$%",
|
||||||
|
|
|
@ -115,6 +115,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_to_magnitude_and_suffix_not_powers_of_1024() {
|
fn test_to_magnitude_and_suffix_not_powers_of_1024() {
|
||||||
assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1.0 B");
|
assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1.0 B");
|
||||||
assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999 B");
|
assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999 B");
|
||||||
|
|
|
@ -103,6 +103,7 @@ fn test_status_level_none() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_all_top_level_args_no_leading_dashes() {
|
fn test_all_top_level_args_no_leading_dashes() {
|
||||||
let args = &[
|
let args = &[
|
||||||
"if=foo.file",
|
"if=foo.file",
|
||||||
|
|
|
@ -239,6 +239,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_to_magnitude_and_suffix_not_powers_of_1024() {
|
fn test_to_magnitude_and_suffix_not_powers_of_1024() {
|
||||||
assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1B");
|
assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1B");
|
||||||
assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999B");
|
assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999B");
|
||||||
|
|
|
@ -548,6 +548,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn all_args_test() {
|
fn all_args_test() {
|
||||||
assert!(options("--silent").unwrap().quiet);
|
assert!(options("--silent").unwrap().quiet);
|
||||||
assert!(options("--quiet").unwrap().quiet);
|
assert!(options("--quiet").unwrap().quiet);
|
||||||
|
|
|
@ -153,6 +153,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_parse_numbers_obsolete() {
|
fn test_parse_numbers_obsolete() {
|
||||||
assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"]));
|
assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"]));
|
||||||
assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"]));
|
assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"]));
|
||||||
|
|
|
@ -394,6 +394,7 @@ mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_format() {
|
fn test_format() {
|
||||||
assert_eq!(NumberFormat::Left.format(12, 1), "12");
|
assert_eq!(NumberFormat::Left.format(12, 1), "12");
|
||||||
assert_eq!(NumberFormat::Left.format(-12, 1), "-12");
|
assert_eq!(NumberFormat::Left.format(-12, 1), "-12");
|
||||||
|
|
|
@ -430,6 +430,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_round_with_precision() {
|
fn test_round_with_precision() {
|
||||||
let rm = RoundMethod::FromZero;
|
let rm = RoundMethod::FromZero;
|
||||||
assert_eq!(1.0, round_with_precision(0.12345, rm, 0));
|
assert_eq!(1.0, round_with_precision(0.12345, rm, 0));
|
||||||
|
|
|
@ -266,6 +266,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_parse_format_with_invalid_formats() {
|
fn test_parse_format_with_invalid_formats() {
|
||||||
assert!("".parse::<FormatOptions>().is_err());
|
assert!("".parse::<FormatOptions>().is_err());
|
||||||
assert!("hello".parse::<FormatOptions>().is_err());
|
assert!("hello".parse::<FormatOptions>().is_err());
|
||||||
|
|
|
@ -198,6 +198,7 @@ fn test_format_flo64() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_format_flo16() {
|
fn test_format_flo16() {
|
||||||
assert_eq!(format_flo16(f16::from_bits(0x8400u16)), "-6.104e-5");
|
assert_eq!(format_flo16(f16::from_bits(0x8400u16)), "-6.104e-5");
|
||||||
assert_eq!(format_flo16(f16::from_bits(0x8401u16)), "-6.109e-5");
|
assert_eq!(format_flo16(f16::from_bits(0x8401u16)), "-6.109e-5");
|
||||||
|
|
|
@ -538,6 +538,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_num_integral_digits() {
|
fn test_num_integral_digits() {
|
||||||
// no decimal, no exponent
|
// no decimal, no exponent
|
||||||
assert_eq!(num_integral_digits("123"), 3);
|
assert_eq!(num_integral_digits("123"), 3);
|
||||||
|
@ -578,6 +579,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_num_fractional_digits() {
|
fn test_num_fractional_digits() {
|
||||||
// no decimal, no exponent
|
// no decimal, no exponent
|
||||||
assert_eq!(num_fractional_digits("123"), 0);
|
assert_eq!(num_fractional_digits("123"), 0);
|
||||||
|
|
|
@ -398,6 +398,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_dynamic_width_number_display_alphabetic() {
|
fn test_dynamic_width_number_display_alphabetic() {
|
||||||
fn num(n: usize) -> Number {
|
fn num(n: usize) -> Number {
|
||||||
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(26, 0));
|
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(26, 0));
|
||||||
|
@ -443,6 +444,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_dynamic_width_number_display_numeric_hexadecimal() {
|
fn test_dynamic_width_number_display_numeric_hexadecimal() {
|
||||||
fn num(n: usize) -> Number {
|
fn num(n: usize) -> Number {
|
||||||
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16, 0));
|
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16, 0));
|
||||||
|
@ -467,6 +469,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_fixed_width_number_increment() {
|
fn test_fixed_width_number_increment() {
|
||||||
let mut n = Number::FixedWidth(FixedWidthNumber::new(3, 2, 0).unwrap());
|
let mut n = Number::FixedWidth(FixedWidthNumber::new(3, 2, 0).unwrap());
|
||||||
assert_eq!(n.digits(), vec![0, 0]);
|
assert_eq!(n.digits(), vec![0, 0]);
|
||||||
|
@ -490,6 +493,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_fixed_width_number_display_alphabetic() {
|
fn test_fixed_width_number_display_alphabetic() {
|
||||||
fn num(n: usize) -> Result<Number, Overflow> {
|
fn num(n: usize) -> Result<Number, Overflow> {
|
||||||
let mut number = Number::FixedWidth(FixedWidthNumber::new(26, 2, 0).unwrap());
|
let mut number = Number::FixedWidth(FixedWidthNumber::new(26, 2, 0).unwrap());
|
||||||
|
|
|
@ -1846,6 +1846,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_number_type_from_error() {
|
fn test_number_type_from_error() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumberType::from("xyz").unwrap_err(),
|
NumberType::from("xyz").unwrap_err(),
|
||||||
|
|
|
@ -947,6 +947,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn test_group_num() {
|
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"));
|
||||||
|
|
Loading…
Reference in a new issue