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/case_insensitive.zigmodified+9-9
Changes to tests/case_insensitive.zig
@@ -4,7 +4,7 @@ const common = @import("regex").common;
44
55test "case insensitive: simple literal" {
66 const allocator = std.testing.allocator;
7 var regex = try Regex.compileWithFlags(allocator, "hello", .{ .case_insensitive = true });
7 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "hello", .{ .case_insensitive = true });
88 defer regex.deinit();
99
1010 try std.testing.expect(try regex.isMatch("hello"));
@@ -16,7 +16,7 @@ test "case insensitive: simple literal" {
1616
1717test "case insensitive: with quantifiers" {
1818 const allocator = std.testing.allocator;
19 var regex = try Regex.compileWithFlags(allocator, "a+b*", .{ .case_insensitive = true });
19 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "a+b*", .{ .case_insensitive = true });
2020 defer regex.deinit();
2121
2222 try std.testing.expect(try regex.isMatch("aaa"));
@@ -29,7 +29,7 @@ test "case insensitive: with quantifiers" {
2929
3030test "case insensitive: mixed with alternation" {
3131 const allocator = std.testing.allocator;
32 var regex = try Regex.compileWithFlags(allocator, "cat|dog", .{ .case_insensitive = true });
32 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "cat|dog", .{ .case_insensitive = true });
3333 defer regex.deinit();
3434
3535 try std.testing.expect(try regex.isMatch("cat"));
@@ -42,7 +42,7 @@ test "case insensitive: mixed with alternation" {
4242
4343test "case insensitive: find in text" {
4444 const allocator = std.testing.allocator;
45 var regex = try Regex.compileWithFlags(allocator, "hello", .{ .case_insensitive = true });
45 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "hello", .{ .case_insensitive = true });
4646 defer regex.deinit();
4747
4848 if (try regex.find("Say HELLO world")) |match| {
@@ -56,7 +56,7 @@ test "case insensitive: find in text" {
5656
5757test "case insensitive: with anchors" {
5858 const allocator = std.testing.allocator;
59 var regex = try Regex.compileWithFlags(allocator, "^hello$", .{ .case_insensitive = true });
59 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "^hello$", .{ .case_insensitive = true });
6060 defer regex.deinit();
6161
6262 try std.testing.expect(try regex.isMatch("hello"));
@@ -68,7 +68,7 @@ test "case insensitive: with anchors" {
6868
6969test "case insensitive: replace" {
7070 const allocator = std.testing.allocator;
71 var regex = try Regex.compileWithFlags(allocator, "hello", .{ .case_insensitive = true });
71 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "hello", .{ .case_insensitive = true });
7272 defer regex.deinit();
7373
7474 const result = try regex.replace(allocator, "Say HELLO world", "hi");
@@ -79,7 +79,7 @@ test "case insensitive: replace" {
7979
8080test "case insensitive: replaceAll" {
8181 const allocator = std.testing.allocator;
82 var regex = try Regex.compileWithFlags(allocator, "a", .{ .case_insensitive = true });
82 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "a", .{ .case_insensitive = true });
8383 defer regex.deinit();
8484
8585 const result = try regex.replaceAll(allocator, "AaAa", "X");
@@ -90,7 +90,7 @@ test "case insensitive: replaceAll" {
9090
9191test "case insensitive: disabled by default" {
9292 const allocator = std.testing.allocator;
93 var regex = try Regex.compile(allocator, "hello");
93 var regex = try Regex.compile(allocator, std.testing.io, "hello");
9494 defer regex.deinit();
9595
9696 try std.testing.expect(try regex.isMatch("hello"));
@@ -100,7 +100,7 @@ test "case insensitive: disabled by default" {
100100
101101test "case insensitive: with numbers and special chars" {
102102 const allocator = std.testing.allocator;
103 var regex = try Regex.compileWithFlags(allocator, "test123", .{ .case_insensitive = true });
103 var regex = try Regex.compileWithFlags(allocator, std.testing.io, "test123", .{ .case_insensitive = true });
104104 defer regex.deinit();
105105
106106 try std.testing.expect(try regex.isMatch("test123"));