1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

Merge pull request #5786 from samueltardieu/style-fixes

uucore: fix style in tests
This commit is contained in:
Sylvestre Ledru 2024-01-05 12:39:48 +01:00 committed by GitHub
commit e341759dfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View file

@ -662,7 +662,7 @@ mod tests {
let target = Path::new("data.txt");
let suffix = String::from(".bak");
assert!(source_is_target_backup(&source, &target, &suffix));
assert!(source_is_target_backup(source, target, &suffix));
}
#[test]
@ -671,7 +671,7 @@ mod tests {
let target = Path::new("backup.txt");
let suffix = String::from(".bak");
assert!(!source_is_target_backup(&source, &target, &suffix));
assert!(!source_is_target_backup(source, target, &suffix));
}
#[test]
@ -680,6 +680,6 @@ mod tests {
let target = Path::new("example");
let suffix = String::from("~");
assert!(source_is_target_backup(&source, &target, &suffix));
assert!(source_is_target_backup(source, target, &suffix));
}
}

View file

@ -878,7 +878,7 @@ mod tests {
let path1 = temp_file.path();
let path2 = temp_file.path();
assert!(are_hardlinks_to_same_file(&path1, &path2));
assert!(are_hardlinks_to_same_file(path1, path2));
}
#[cfg(unix)]
@ -893,7 +893,7 @@ mod tests {
let path1 = temp_file1.path();
let path2 = temp_file2.path();
assert!(!are_hardlinks_to_same_file(&path1, &path2));
assert!(!are_hardlinks_to_same_file(path1, path2));
}
#[cfg(unix)]
@ -904,9 +904,9 @@ mod tests {
let path1 = temp_file.path();
let path2 = temp_file.path().with_extension("hardlink");
fs::hard_link(&path1, &path2).unwrap();
fs::hard_link(path1, &path2).unwrap();
assert!(are_hardlinks_to_same_file(&path1, &path2));
assert!(are_hardlinks_to_same_file(path1, &path2));
}
#[cfg(unix)]

View file

@ -424,23 +424,23 @@ mod tests {
for &(c, exp) in &suffixes {
let s = format!("2{c}B"); // KB
assert_eq!(Ok((2 * (1000_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok(2 * (1000_u128).pow(exp)), parse_size_u128(&s));
let s = format!("2{c}"); // K
assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok(2 * (1024_u128).pow(exp)), parse_size_u128(&s));
let s = format!("2{c}iB"); // KiB
assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok(2 * (1024_u128).pow(exp)), parse_size_u128(&s));
let s = format!("2{}iB", c.to_lowercase()); // kiB
assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok(2 * (1024_u128).pow(exp)), parse_size_u128(&s));
// suffix only
let s = format!("{c}B"); // KB
assert_eq!(Ok(((1000_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok((1000_u128).pow(exp)), parse_size_u128(&s));
let s = format!("{c}"); // K
assert_eq!(Ok(((1024_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok((1024_u128).pow(exp)), parse_size_u128(&s));
let s = format!("{c}iB"); // KiB
assert_eq!(Ok(((1024_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok((1024_u128).pow(exp)), parse_size_u128(&s));
let s = format!("{}iB", c.to_lowercase()); // kiB
assert_eq!(Ok(((1024_u128).pow(exp)) as u128), parse_size_u128(&s));
assert_eq!(Ok((1024_u128).pow(exp)), parse_size_u128(&s));
}
}

View file

@ -163,7 +163,7 @@ mod tests {
let parser = ShortcutValueParser::new(["abcd"]);
let cmd = Command::new("cmd");
let result = parser.parse_ref(&cmd, None, OsStr::from_bytes(&[0xc3 as u8, 0x28 as u8]));
let result = parser.parse_ref(&cmd, None, OsStr::from_bytes(&[0xc3, 0x28]));
assert_eq!(ErrorKind::InvalidUtf8, result.unwrap_err().kind());
}
}