diff options
| author | 2024-11-02 10:30:57 -0400 | |
|---|---|---|
| committer | 2024-11-02 10:30:57 -0400 | |
| commit | 1ff9f7cf2f90850324f61041566206f6d93488c7 (patch) | |
| tree | d604637ae898bae0b9db2d66537c788772a7a29d /src/unicode_tests.zig | |
| parent | Merge pull request 'GraphemeData and WidthData: make init read errors unreach... (diff) | |
| download | zg-1ff9f7cf2f90850324f61041566206f6d93488c7.tar.gz zg-1ff9f7cf2f90850324f61041566206f6d93488c7.tar.xz zg-1ff9f7cf2f90850324f61041566206f6d93488c7.zip | |
Replace deprecated uses of std.mem.split
Diffstat (limited to 'src/unicode_tests.zig')
| -rw-r--r-- | src/unicode_tests.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/unicode_tests.zig b/src/unicode_tests.zig index 448ce41..691ccfb 100644 --- a/src/unicode_tests.zig +++ b/src/unicode_tests.zig | |||
| @@ -35,7 +35,7 @@ test "Unicode normalization tests" { | |||
| 35 | // Skip comments or empty lines. | 35 | // Skip comments or empty lines. |
| 36 | if (line.len == 0 or line[0] == '#' or line[0] == '@') continue; | 36 | if (line.len == 0 or line[0] == '#' or line[0] == '@') continue; |
| 37 | // Iterate over fields. | 37 | // Iterate over fields. |
| 38 | var fields = mem.split(u8, line, ";"); | 38 | var fields = mem.splitScalar(u8, line, ';'); |
| 39 | var field_index: usize = 0; | 39 | var field_index: usize = 0; |
| 40 | var input: []u8 = undefined; | 40 | var input: []u8 = undefined; |
| 41 | defer allocator.free(input); | 41 | defer allocator.free(input); |
| @@ -45,7 +45,7 @@ test "Unicode normalization tests" { | |||
| 45 | var i_buf = std.ArrayList(u8).init(allocator); | 45 | var i_buf = std.ArrayList(u8).init(allocator); |
| 46 | defer i_buf.deinit(); | 46 | defer i_buf.deinit(); |
| 47 | 47 | ||
| 48 | var i_fields = mem.split(u8, field, " "); | 48 | var i_fields = mem.splitScalar(u8, field, ' '); |
| 49 | while (i_fields.next()) |s| { | 49 | while (i_fields.next()) |s| { |
| 50 | const icp = try fmt.parseInt(u21, s, 16); | 50 | const icp = try fmt.parseInt(u21, s, 16); |
| 51 | const len = try unicode.utf8Encode(icp, &cp_buf); | 51 | const len = try unicode.utf8Encode(icp, &cp_buf); |
| @@ -59,7 +59,7 @@ test "Unicode normalization tests" { | |||
| 59 | var w_buf = std.ArrayList(u8).init(allocator); | 59 | var w_buf = std.ArrayList(u8).init(allocator); |
| 60 | defer w_buf.deinit(); | 60 | defer w_buf.deinit(); |
| 61 | 61 | ||
| 62 | var w_fields = mem.split(u8, field, " "); | 62 | var w_fields = mem.splitScalar(u8, field, ' '); |
| 63 | while (w_fields.next()) |s| { | 63 | while (w_fields.next()) |s| { |
| 64 | const wcp = try fmt.parseInt(u21, s, 16); | 64 | const wcp = try fmt.parseInt(u21, s, 16); |
| 65 | const len = try unicode.utf8Encode(wcp, &cp_buf); | 65 | const len = try unicode.utf8Encode(wcp, &cp_buf); |
| @@ -76,7 +76,7 @@ test "Unicode normalization tests" { | |||
| 76 | var w_buf = std.ArrayList(u8).init(allocator); | 76 | var w_buf = std.ArrayList(u8).init(allocator); |
| 77 | defer w_buf.deinit(); | 77 | defer w_buf.deinit(); |
| 78 | 78 | ||
| 79 | var w_fields = mem.split(u8, field, " "); | 79 | var w_fields = mem.splitScalar(u8, field, ' '); |
| 80 | while (w_fields.next()) |s| { | 80 | while (w_fields.next()) |s| { |
| 81 | const wcp = try fmt.parseInt(u21, s, 16); | 81 | const wcp = try fmt.parseInt(u21, s, 16); |
| 82 | const len = try unicode.utf8Encode(wcp, &cp_buf); | 82 | const len = try unicode.utf8Encode(wcp, &cp_buf); |
| @@ -93,7 +93,7 @@ test "Unicode normalization tests" { | |||
| 93 | var w_buf = std.ArrayList(u8).init(allocator); | 93 | var w_buf = std.ArrayList(u8).init(allocator); |
| 94 | defer w_buf.deinit(); | 94 | defer w_buf.deinit(); |
| 95 | 95 | ||
| 96 | var w_fields = mem.split(u8, field, " "); | 96 | var w_fields = mem.splitScalar(u8, field, ' '); |
| 97 | while (w_fields.next()) |s| { | 97 | while (w_fields.next()) |s| { |
| 98 | const wcp = try fmt.parseInt(u21, s, 16); | 98 | const wcp = try fmt.parseInt(u21, s, 16); |
| 99 | const len = try unicode.utf8Encode(wcp, &cp_buf); | 99 | const len = try unicode.utf8Encode(wcp, &cp_buf); |
| @@ -110,7 +110,7 @@ test "Unicode normalization tests" { | |||
| 110 | var w_buf = std.ArrayList(u8).init(allocator); | 110 | var w_buf = std.ArrayList(u8).init(allocator); |
| 111 | defer w_buf.deinit(); | 111 | defer w_buf.deinit(); |
| 112 | 112 | ||
| 113 | var w_fields = mem.split(u8, field, " "); | 113 | var w_fields = mem.splitScalar(u8, field, ' '); |
| 114 | while (w_fields.next()) |s| { | 114 | while (w_fields.next()) |s| { |
| 115 | const wcp = try fmt.parseInt(u21, s, 16); | 115 | const wcp = try fmt.parseInt(u21, s, 16); |
| 116 | const len = try unicode.utf8Encode(wcp, &cp_buf); | 116 | const len = try unicode.utf8Encode(wcp, &cp_buf); |
| @@ -158,11 +158,11 @@ test "Segmentation GraphemeIterator" { | |||
| 158 | var all_bytes = std.ArrayList(u8).init(allocator); | 158 | var all_bytes = std.ArrayList(u8).init(allocator); |
| 159 | defer all_bytes.deinit(); | 159 | defer all_bytes.deinit(); |
| 160 | 160 | ||
| 161 | var graphemes = std.mem.split(u8, line, " ÷ "); | 161 | var graphemes = std.mem.splitSequence(u8, line, " ÷ "); |
| 162 | var bytes_index: u32 = 0; | 162 | var bytes_index: u32 = 0; |
| 163 | 163 | ||
| 164 | while (graphemes.next()) |field| { | 164 | while (graphemes.next()) |field| { |
| 165 | var code_points = std.mem.split(u8, field, " "); | 165 | var code_points = std.mem.splitScalar(u8, field, ' '); |
| 166 | var cp_buf: [4]u8 = undefined; | 166 | var cp_buf: [4]u8 = undefined; |
| 167 | var cp_index: u32 = 0; | 167 | var cp_index: u32 = 0; |
| 168 | var gc_len: u8 = 0; | 168 | var gc_len: u8 = 0; |