diff options
| author | 2025-04-30 11:58:19 -0400 | |
|---|---|---|
| committer | 2025-04-30 11:58:19 -0400 | |
| commit | 1be5e46490e061761b4b97dff5c6acb2181d6fe9 (patch) | |
| tree | 77a1edcdedd7afae7428e92feba37d2bb1035b22 /src/unicode_tests.zig | |
| parent | Add general tests step (diff) | |
| download | zg-1be5e46490e061761b4b97dff5c6acb2181d6fe9.tar.gz zg-1be5e46490e061761b4b97dff5c6acb2181d6fe9.tar.xz zg-1be5e46490e061761b4b97dff5c6acb2181d6fe9.zip | |
Factor out 'Data' for grapheme and DisplayWidth
In the process of refactoring the whole library, so that it doesn't
expose anything called "Data" separately from user functionality.
Diffstat (limited to 'src/unicode_tests.zig')
| -rw-r--r-- | src/unicode_tests.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/unicode_tests.zig b/src/unicode_tests.zig index 7236ff6..de1b9ec 100644 --- a/src/unicode_tests.zig +++ b/src/unicode_tests.zig | |||
| @@ -9,7 +9,7 @@ const unicode = std.unicode; | |||
| 9 | 9 | ||
| 10 | const grapheme = @import("grapheme"); | 10 | const grapheme = @import("grapheme"); |
| 11 | const Grapheme = @import("grapheme").Grapheme; | 11 | const Grapheme = @import("grapheme").Grapheme; |
| 12 | const GraphemeData = @import("grapheme").GraphemeData; | 12 | const Graphemes = @import("grapheme"); |
| 13 | const GraphemeIterator = @import("grapheme").Iterator; | 13 | const GraphemeIterator = @import("grapheme").Iterator; |
| 14 | const Normalize = @import("Normalize"); | 14 | const Normalize = @import("Normalize"); |
| 15 | 15 | ||
| @@ -18,10 +18,10 @@ comptime { | |||
| 18 | } | 18 | } |
| 19 | test "Iterator.peek" { | 19 | test "Iterator.peek" { |
| 20 | const peek_seq = "aΔ👨🏻🌾→"; | 20 | const peek_seq = "aΔ👨🏻🌾→"; |
| 21 | const data = try GraphemeData.init(std.testing.allocator); | 21 | const data = try Graphemes.init(std.testing.allocator); |
| 22 | defer data.deinit(std.testing.allocator); | 22 | defer data.deinit(std.testing.allocator); |
| 23 | 23 | ||
| 24 | var iter = grapheme.Iterator.init(peek_seq, &data); | 24 | var iter = data.iterator(peek_seq); |
| 25 | const peek_a = iter.peek().?; | 25 | const peek_a = iter.peek().?; |
| 26 | const next_a = iter.next().?; | 26 | const next_a = iter.next().?; |
| 27 | try std.testing.expectEqual(peek_a, next_a); | 27 | try std.testing.expectEqual(peek_a, next_a); |
| @@ -162,7 +162,7 @@ test "Segmentation GraphemeIterator" { | |||
| 162 | var buf_reader = std.io.bufferedReader(file.reader()); | 162 | var buf_reader = std.io.bufferedReader(file.reader()); |
| 163 | var input_stream = buf_reader.reader(); | 163 | var input_stream = buf_reader.reader(); |
| 164 | 164 | ||
| 165 | const data = try GraphemeData.init(allocator); | 165 | const data = try Graphemes.init(allocator); |
| 166 | defer data.deinit(allocator); | 166 | defer data.deinit(allocator); |
| 167 | 167 | ||
| 168 | var buf: [4096]u8 = undefined; | 168 | var buf: [4096]u8 = undefined; |
| @@ -207,7 +207,7 @@ test "Segmentation GraphemeIterator" { | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | // std.debug.print("\nline {}: {s}\n", .{ line_no, all_bytes.items }); | 209 | // std.debug.print("\nline {}: {s}\n", .{ line_no, all_bytes.items }); |
| 210 | var iter = GraphemeIterator.init(all_bytes.items, &data); | 210 | var iter = data.iterator(all_bytes.items); |
| 211 | 211 | ||
| 212 | // Chaeck. | 212 | // Chaeck. |
| 213 | for (want.items) |want_gc| { | 213 | for (want.items) |want_gc| { |