also looking at this
Port to latest zig-master
#2
53 files
+1149
-1017
| @@ -3,7 +3,7 @@ const Regex = @import("regex").Regex; | ||
| 3 | 3 | |
| 4 | 4 | test "quantifier: exactly n times {3}" { |
| 5 | 5 | 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}"); | |
| 7 | 7 | defer regex.deinit(); |
| 8 | 8 | |
| 9 | 9 | try std.testing.expect(!try regex.isMatch("aa")); |
| @@ -13,7 +13,7 @@ test "quantifier: exactly n times {3}" { | ||
| 13 | 13 | |
| 14 | 14 | test "quantifier: range {2,4}" { |
| 15 | 15 | 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}"); | |
| 17 | 17 | defer regex.deinit(); |
| 18 | 18 | |
| 19 | 19 | try std.testing.expect(!try regex.isMatch("a")); |
| @@ -25,7 +25,7 @@ test "quantifier: range {2,4}" { | ||
| 25 | 25 | |
| 26 | 26 | test "quantifier: at least n {2,}" { |
| 27 | 27 | 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,}"); | |
| 29 | 29 | defer regex.deinit(); |
| 30 | 30 | |
| 31 | 31 | try std.testing.expect(!try regex.isMatch("a")); |
| @@ -36,7 +36,7 @@ test "quantifier: at least n {2,}" { | ||
| 36 | 36 | |
| 37 | 37 | test "quantifier: {0,1} equivalent to ?" { |
| 38 | 38 | 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}"); | |
| 40 | 40 | defer regex.deinit(); |
| 41 | 41 | |
| 42 | 42 | try std.testing.expect(try regex.isMatch("")); |
| @@ -46,7 +46,7 @@ test "quantifier: {0,1} equivalent to ?" { | ||
| 46 | 46 | |
| 47 | 47 | test "quantifier: {1,} equivalent to +" { |
| 48 | 48 | 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,}"); | |
| 50 | 50 | defer regex.deinit(); |
| 51 | 51 | |
| 52 | 52 | try std.testing.expect(!try regex.isMatch("")); |
| @@ -56,7 +56,7 @@ test "quantifier: {1,} equivalent to +" { | ||
| 56 | 56 | |
| 57 | 57 | test "quantifier: {0,} equivalent to *" { |
| 58 | 58 | 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,}"); | |
| 60 | 60 | defer regex.deinit(); |
| 61 | 61 | |
| 62 | 62 | try std.testing.expect(try regex.isMatch("")); |
| @@ -66,7 +66,7 @@ test "quantifier: {0,} equivalent to *" { | ||
| 66 | 66 | |
| 67 | 67 | test "quantifier: complex pattern with {m,n}" { |
| 68 | 68 | 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}"); | |
| 70 | 70 | defer regex.deinit(); |
| 71 | 71 | |
| 72 | 72 | if (try regex.find("Call 555-1234 now")) |match| { |
| @@ -80,7 +80,7 @@ test "quantifier: complex pattern with {m,n}" { | ||
| 80 | 80 | |
| 81 | 81 | test "quantifier: multiple bounded quantifiers" { |
| 82 | 82 | 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}"); | |
| 84 | 84 | defer regex.deinit(); |
| 85 | 85 | |
| 86 | 86 | try std.testing.expect(!try regex.isMatch("ab")); |
| @@ -91,7 +91,7 @@ test "quantifier: multiple bounded quantifiers" { | ||
| 91 | 91 | |
| 92 | 92 | test "quantifier: {m,n} with character class" { |
| 93 | 93 | 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}"); | |
| 95 | 95 | defer regex.deinit(); |
| 96 | 96 | |
| 97 | 97 | try std.testing.expect(!try regex.isMatch("ab")); |