also looking at this
Port to latest zig-master
#2
53 files
+1149
-1017
| @@ -6,11 +6,11 @@ test "multiline flag: ^ matches after newlines" { | ||
| 6 | 6 | const allocator = std.testing.allocator; |
| 7 | 7 | |
| 8 | 8 | // Without multiline flag |
| 9 | var regex_single = try Regex.compileWithFlags(allocator, "^test", .{ .multiline = false }); | |
| 9 | var regex_single = try Regex.compileWithFlags(allocator, std.testing.io, "^test", .{ .multiline = false }); | |
| 10 | 10 | defer regex_single.deinit(); |
| 11 | 11 | |
| 12 | 12 | // With multiline flag |
| 13 | var regex_multi = try Regex.compileWithFlags(allocator, "^test", .{ .multiline = true }); | |
| 13 | var regex_multi = try Regex.compileWithFlags(allocator, std.testing.io, "^test", .{ .multiline = true }); | |
| 14 | 14 | defer regex_multi.deinit(); |
| 15 | 15 | |
| 16 | 16 | const input = "line1\ntest"; |
| @@ -26,11 +26,11 @@ test "multiline flag: $ matches before newlines" { | ||
| 26 | 26 | const allocator = std.testing.allocator; |
| 27 | 27 | |
| 28 | 28 | // Without multiline flag |
| 29 | var regex_single = try Regex.compileWithFlags(allocator, "test$", .{ .multiline = false }); | |
| 29 | var regex_single = try Regex.compileWithFlags(allocator, std.testing.io, "test$", .{ .multiline = false }); | |
| 30 | 30 | defer regex_single.deinit(); |
| 31 | 31 | |
| 32 | 32 | // With multiline flag |
| 33 | var regex_multi = try Regex.compileWithFlags(allocator, "test$", .{ .multiline = true }); | |
| 33 | var regex_multi = try Regex.compileWithFlags(allocator, std.testing.io, "test$", .{ .multiline = true }); | |
| 34 | 34 | defer regex_multi.deinit(); |
| 35 | 35 | |
| 36 | 36 | const input = "test\nline2"; |
| @@ -45,7 +45,7 @@ test "multiline flag: $ matches before newlines" { | ||
| 45 | 45 | test "multiline flag: complex pattern" { |
| 46 | 46 | const allocator = std.testing.allocator; |
| 47 | 47 | |
| 48 | var regex = try Regex.compileWithFlags(allocator, "^\\w+$", .{ .multiline = true }); | |
| 48 | var regex = try Regex.compileWithFlags(allocator, std.testing.io, "^\\w+$", .{ .multiline = true }); | |
| 49 | 49 | defer regex.deinit(); |
| 50 | 50 | |
| 51 | 51 | // Should match each line |
| @@ -57,11 +57,11 @@ test "dot-all flag: . matches newlines" { | ||
| 57 | 57 | const allocator = std.testing.allocator; |
| 58 | 58 | |
| 59 | 59 | // Without dot-all flag |
| 60 | var regex_normal = try Regex.compileWithFlags(allocator, "a.b", .{ .dot_all = false }); | |
| 60 | var regex_normal = try Regex.compileWithFlags(allocator, std.testing.io, "a.b", .{ .dot_all = false }); | |
| 61 | 61 | defer regex_normal.deinit(); |
| 62 | 62 | |
| 63 | 63 | // With dot-all flag |
| 64 | var regex_dotall = try Regex.compileWithFlags(allocator, "a.b", .{ .dot_all = true }); | |
| 64 | var regex_dotall = try Regex.compileWithFlags(allocator, std.testing.io, "a.b", .{ .dot_all = true }); | |
| 65 | 65 | defer regex_dotall.deinit(); |
| 66 | 66 | |
| 67 | 67 | const input_with_newline = "a\nb"; |
| @@ -80,11 +80,11 @@ test "dot-all flag: .* matches across lines" { | ||
| 80 | 80 | const allocator = std.testing.allocator; |
| 81 | 81 | |
| 82 | 82 | // Without dot-all flag |
| 83 | var regex_normal = try Regex.compileWithFlags(allocator, "start.*end", .{ .dot_all = false }); | |
| 83 | var regex_normal = try Regex.compileWithFlags(allocator, std.testing.io, "start.*end", .{ .dot_all = false }); | |
| 84 | 84 | defer regex_normal.deinit(); |
| 85 | 85 | |
| 86 | 86 | // With dot-all flag |
| 87 | var regex_dotall = try Regex.compileWithFlags(allocator, "start.*end", .{ .dot_all = true }); | |
| 87 | var regex_dotall = try Regex.compileWithFlags(allocator, std.testing.io, "start.*end", .{ .dot_all = true }); | |
| 88 | 88 | defer regex_dotall.deinit(); |
| 89 | 89 | |
| 90 | 90 | const input = "start\nmiddle\nend"; |
| @@ -99,7 +99,7 @@ test "dot-all flag: .* matches across lines" { | ||
| 99 | 99 | test "combined multiline and dot-all flags" { |
| 100 | 100 | const allocator = std.testing.allocator; |
| 101 | 101 | |
| 102 | var regex = try Regex.compileWithFlags(allocator, "^.*$", .{ | |
| 102 | var regex = try Regex.compileWithFlags(allocator, std.testing.io, "^.*$", .{ | |
| 103 | 103 | .multiline = true, |
| 104 | 104 | .dot_all = true, |
| 105 | 105 | }); |
| @@ -112,7 +112,7 @@ test "combined multiline and dot-all flags" { | ||
| 112 | 112 | test "multiline flag: multiple matches with findAll" { |
| 113 | 113 | const allocator = std.testing.allocator; |
| 114 | 114 | |
| 115 | var regex = try Regex.compileWithFlags(allocator, "^\\d+", .{ .multiline = true }); | |
| 115 | var regex = try Regex.compileWithFlags(allocator, std.testing.io, "^\\d+", .{ .multiline = true }); | |
| 116 | 116 | defer regex.deinit(); |
| 117 | 117 | |
| 118 | 118 | const matches = try regex.findAll(allocator, "123\n456\n789"); |
| @@ -135,7 +135,7 @@ test "default flags: multiline and dot-all are false" { | ||
| 135 | 135 | const allocator = std.testing.allocator; |
| 136 | 136 | |
| 137 | 137 | // Default compile should have multiline=false and dot_all=false |
| 138 | var regex = try Regex.compile(allocator, "^test$"); | |
| 138 | var regex = try Regex.compile(allocator, std.testing.io, "^test$"); | |
| 139 | 139 | defer regex.deinit(); |
| 140 | 140 | |
| 141 | 141 | // Should not match with newlines |