mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
split: loop over chars and remove char_from_digit function
This commit is contained in:
parent
84bfbb0e5a
commit
631b9892f6
1 changed files with 3 additions and 8 deletions
|
@ -375,11 +375,6 @@ fn file_read(at: &AtPath, filename: &str) -> String {
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Use char::from_digit() in Rust v1.51.0 or later.
|
|
||||||
fn char_from_digit(n: usize) -> char {
|
|
||||||
(b'a' + n as u8) as char
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Test for the default suffix length behavior: dynamically increasing size.
|
/// Test for the default suffix length behavior: dynamically increasing size.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_alphabetic_dynamic_suffix_length() {
|
fn test_alphabetic_dynamic_suffix_length() {
|
||||||
|
@ -396,9 +391,9 @@ fn test_alphabetic_dynamic_suffix_length() {
|
||||||
//
|
//
|
||||||
ucmd.args(&["-b", "1", "sixhundredfiftyonebytes.txt"])
|
ucmd.args(&["-b", "1", "sixhundredfiftyonebytes.txt"])
|
||||||
.succeeds();
|
.succeeds();
|
||||||
for i in 0..25 {
|
for i in b'a'..=b'y' {
|
||||||
for j in 0..26 {
|
for j in b'a'..=b'z' {
|
||||||
let filename = format!("x{}{}", char_from_digit(i), char_from_digit(j),);
|
let filename = format!("x{}{}", i as char, j as char);
|
||||||
let contents = file_read(&at, &filename);
|
let contents = file_read(&at, &filename);
|
||||||
assert_eq!(contents, "a");
|
assert_eq!(contents, "a");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue