ReviewOS

also looking at this

zig-utils/zig-regex

Port to latest zig-master

#2
Closed armagidon-exception wants to merge main into main
53 files +1149 -1017
tests/quantifiers.zigmodified+9-9
Changes to tests/quantifiers.zig
@@ -3,7 +3,7 @@ const Regex = @import("regex").Regex;
33
44test "quantifier: exactly n times {3}" {
55 const allocator = std.testing.allocator;
6 var regex = try Regex.compile(allocator, "a{3}");
6 var regex = try Regex.compile(allocator, std.testing.io, "a{3}");
77 defer regex.deinit();
88
99 try std.testing.expect(!try regex.isMatch("aa"));
@@ -13,7 +13,7 @@ test "quantifier: exactly n times {3}" {
1313
1414test "quantifier: range {2,4}" {
1515 const allocator = std.testing.allocator;
16 var regex = try Regex.compile(allocator, "a{2,4}");
16 var regex = try Regex.compile(allocator, std.testing.io, "a{2,4}");
1717 defer regex.deinit();
1818
1919 try std.testing.expect(!try regex.isMatch("a"));
@@ -25,7 +25,7 @@ test "quantifier: range {2,4}" {
2525
2626test "quantifier: at least n {2,}" {
2727 const allocator = std.testing.allocator;
28 var regex = try Regex.compile(allocator, "a{2,}");
28 var regex = try Regex.compile(allocator, std.testing.io, "a{2,}");
2929 defer regex.deinit();
3030
3131 try std.testing.expect(!try regex.isMatch("a"));
@@ -36,7 +36,7 @@ test "quantifier: at least n {2,}" {
3636
3737test "quantifier: {0,1} equivalent to ?" {
3838 const allocator = std.testing.allocator;
39 var regex = try Regex.compile(allocator, "a{0,1}");
39 var regex = try Regex.compile(allocator, std.testing.io, "a{0,1}");
4040 defer regex.deinit();
4141
4242 try std.testing.expect(try regex.isMatch(""));
@@ -46,7 +46,7 @@ test "quantifier: {0,1} equivalent to ?" {
4646
4747test "quantifier: {1,} equivalent to +" {
4848 const allocator = std.testing.allocator;
49 var regex = try Regex.compile(allocator, "a{1,}");
49 var regex = try Regex.compile(allocator, std.testing.io, "a{1,}");
5050 defer regex.deinit();
5151
5252 try std.testing.expect(!try regex.isMatch(""));
@@ -56,7 +56,7 @@ test "quantifier: {1,} equivalent to +" {
5656
5757test "quantifier: {0,} equivalent to *" {
5858 const allocator = std.testing.allocator;
59 var regex = try Regex.compile(allocator, "a{0,}");
59 var regex = try Regex.compile(allocator, std.testing.io, "a{0,}");
6060 defer regex.deinit();
6161
6262 try std.testing.expect(try regex.isMatch(""));
@@ -66,7 +66,7 @@ test "quantifier: {0,} equivalent to *" {
6666
6767test "quantifier: complex pattern with {m,n}" {
6868 const allocator = std.testing.allocator;
69 var regex = try Regex.compile(allocator, "\\d{3}-\\d{4}");
69 var regex = try Regex.compile(allocator, std.testing.io, "\\d{3}-\\d{4}");
7070 defer regex.deinit();
7171
7272 if (try regex.find("Call 555-1234 now")) |match| {
@@ -80,7 +80,7 @@ test "quantifier: complex pattern with {m,n}" {
8080
8181test "quantifier: multiple bounded quantifiers" {
8282 const allocator = std.testing.allocator;
83 var regex = try Regex.compile(allocator, "a{2}b{3}");
83 var regex = try Regex.compile(allocator, std.testing.io, "a{2}b{3}");
8484 defer regex.deinit();
8585
8686 try std.testing.expect(!try regex.isMatch("ab"));
@@ -91,7 +91,7 @@ test "quantifier: multiple bounded quantifiers" {
9191
9292test "quantifier: {m,n} with character class" {
9393 const allocator = std.testing.allocator;
94 var regex = try Regex.compile(allocator, "[a-z]{3,5}");
94 var regex = try Regex.compile(allocator, std.testing.io, "[a-z]{3,5}");
9595 defer regex.deinit();
9696
9797 try std.testing.expect(!try regex.isMatch("ab"));