diff options
| author | 2025-04-29 15:32:58 -0400 | |
|---|---|---|
| committer | 2025-04-29 15:32:58 -0400 | |
| commit | 35f18e584fae890f686eafcdc12a2fde6281206d (patch) | |
| tree | 4006551bfb221e80fb6c9173383ce48f308c4512 /src/CaseFold.zig | |
| parent | Add result.toOwned() to Normalize.zig (diff) | |
| download | zg-35f18e584fae890f686eafcdc12a2fde6281206d.tar.gz zg-35f18e584fae890f686eafcdc12a2fde6281206d.tar.xz zg-35f18e584fae890f686eafcdc12a2fde6281206d.zip | |
Add general tests step
After a considerable slog, all tests are reachable from the test step,
and pass. Almost every failure was related to the change away from the
inclusion of an allocator on this or that.
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!")); |