Skip to content

Commit

Permalink
Merge pull request #5153 from shinhs0506/split-from-digit
Browse files Browse the repository at this point in the history
split: loop over chars and remove char_from_digit function
  • Loading branch information
cakebaker authored Aug 12, 2023
2 parents 84bfbb0 + 631b989 commit 7a6bd83
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/by-util/test_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,6 @@ fn file_read(at: &AtPath, filename: &str) -> String {
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]
fn test_alphabetic_dynamic_suffix_length() {
Expand All @@ -396,9 +391,9 @@ fn test_alphabetic_dynamic_suffix_length() {
//
ucmd.args(&["-b", "1", "sixhundredfiftyonebytes.txt"])
.succeeds();
for i in 0..25 {
for j in 0..26 {
let filename = format!("x{}{}", char_from_digit(i), char_from_digit(j),);
for i in b'a'..=b'y' {
for j in b'a'..=b'z' {
let filename = format!("x{}{}", i as char, j as char);
let contents = file_read(&at, &filename);
assert_eq!(contents, "a");
}
Expand Down

0 comments on commit 7a6bd83

Please sign in to comment.