diff options
Diffstat (limited to 'src/CaseFold.zig')
| -rw-r--r-- | src/CaseFold.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/CaseFold.zig b/src/CaseFold.zig index 19c9da8..c84a420 100644 --- a/src/CaseFold.zig +++ b/src/CaseFold.zig | |||
| @@ -95,12 +95,13 @@ pub fn compatCaselessMatch( | |||
| 95 | test "compatCaselessMatch" { | 95 | test "compatCaselessMatch" { |
| 96 | const allocator = testing.allocator; | 96 | const allocator = testing.allocator; |
| 97 | 97 | ||
| 98 | const norm_data = try Normalize.NormData.init(allocator); | 98 | var norm_data = Normalize.NormData{}; |
| 99 | defer norm_data.deinit(); | 99 | try norm_data.init(allocator); |
| 100 | defer norm_data.deinit(allocator); | ||
| 100 | const n = Normalize{ .norm_data = &norm_data }; | 101 | const n = Normalize{ .norm_data = &norm_data }; |
| 101 | 102 | ||
| 102 | const fold_data = try FoldData.init(allocator); | 103 | const fold_data = try FoldData.init(allocator); |
| 103 | defer fold_data.deinit(); | 104 | defer fold_data.deinit(allocator); |
| 104 | const caser = Self{ .fold_data = &fold_data }; | 105 | const caser = Self{ .fold_data = &fold_data }; |
| 105 | 106 | ||
| 106 | try testing.expect(try caser.compatCaselessMatch(allocator, &n, "ascii only!", "ASCII Only!")); | 107 | try testing.expect(try caser.compatCaselessMatch(allocator, &n, "ascii only!", "ASCII Only!")); |
| @@ -170,12 +171,13 @@ pub fn canonCaselessMatch( | |||
| 170 | test "canonCaselessMatch" { | 171 | test "canonCaselessMatch" { |
| 171 | const allocator = testing.allocator; | 172 | const allocator = testing.allocator; |
| 172 | 173 | ||
| 173 | const norm_data = try Normalize.NormData.init(allocator); | 174 | var norm_data = Normalize.NormData{}; |
| 174 | defer norm_data.deinit(); | 175 | try norm_data.init(allocator); |
| 176 | defer norm_data.deinit(allocator); | ||
| 175 | const n = Normalize{ .norm_data = &norm_data }; | 177 | const n = Normalize{ .norm_data = &norm_data }; |
| 176 | 178 | ||
| 177 | const fold_data = try FoldData.init(allocator); | 179 | const fold_data = try FoldData.init(allocator); |
| 178 | defer fold_data.deinit(); | 180 | defer fold_data.deinit(allocator); |
| 179 | const caser = Self{ .fold_data = &fold_data }; | 181 | const caser = Self{ .fold_data = &fold_data }; |
| 180 | 182 | ||
| 181 | try testing.expect(try caser.canonCaselessMatch(allocator, &n, "ascii only!", "ASCII Only!")); | 183 | try testing.expect(try caser.canonCaselessMatch(allocator, &n, "ascii only!", "ASCII Only!")); |