summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sam Atman2025-04-29 12:22:13 -0400
committerGravatar Sam Atman2025-04-29 12:22:13 -0400
commit0ff76e5f7f62756b1e1fc6657039fc0e004f19e1 (patch)
tree3941bb48653a33959bb93d2bc9bc5fbac8d1c4c5
parentAdd c0 and c1 control width options (diff)
downloadzg-0ff76e5f7f62756b1e1fc6657039fc0e004f19e1.tar.gz
zg-0ff76e5f7f62756b1e1fc6657039fc0e004f19e1.tar.xz
zg-0ff76e5f7f62756b1e1fc6657039fc0e004f19e1.zip
Bump copyright year, isolate iterator tests
-rw-r--r--LICENSE2
-rw-r--r--src/grapheme.zig31
2 files changed, 19 insertions, 14 deletions
diff --git a/LICENSE b/LICENSE
index effe8cb..1651d31 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,7 @@
1MIT License 1MIT License
2 2
3Copyright (c) 2021 Jose Colon Rodriguez 3Copyright (c) 2021 Jose Colon Rodriguez
4Copyright (c) 2024 Sam Atman and contributors 4Copyright (c) 2025 Sam Atman and contributors
5 5
6Permission is hereby granted, free of charge, to any person obtaining a copy 6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal 7of this software and associated documentation files (the "Software"), to deal
diff --git a/src/grapheme.zig b/src/grapheme.zig
index 7538f5b..a802df8 100644
--- a/src/grapheme.zig
+++ b/src/grapheme.zig
@@ -309,19 +309,24 @@ test "Segmentation ZWJ and ZWSP emoji sequences" {
309 const data = try GraphemeData.init(std.testing.allocator); 309 const data = try GraphemeData.init(std.testing.allocator);
310 defer data.deinit(); 310 defer data.deinit();
311 311
312 var iter = Iterator.init(with_zwj, &data); 312 {
313 313 var iter = Iterator.init(with_zwj, &data);
314 var i: usize = 0; 314 var i: usize = 0;
315 while (iter.next()) |_| : (i += 1) {} 315 while (iter.next()) |_| : (i += 1) {}
316 try std.testing.expectEqual(@as(usize, 1), i); 316 try std.testing.expectEqual(@as(usize, 1), i);
317 }
317 318
318 iter = Iterator.init(with_zwsp, &data); 319 {
319 i = 0; 320 var iter = Iterator.init(with_zwsp, &data);
320 while (iter.next()) |_| : (i += 1) {} 321 var i: usize = 0;
321 try std.testing.expectEqual(@as(usize, 3), i); 322 while (iter.next()) |_| : (i += 1) {}
323 try std.testing.expectEqual(@as(usize, 3), i);
324 }
322 325
323 iter = Iterator.init(no_joiner, &data); 326 {
324 i = 0; 327 var iter = Iterator.init(no_joiner, &data);
325 while (iter.next()) |_| : (i += 1) {} 328 var i: usize = 0;
326 try std.testing.expectEqual(@as(usize, 2), i); 329 while (iter.next()) |_| : (i += 1) {}
330 try std.testing.expectEqual(@as(usize, 2), i);
331 }
327} 332}