diff options
| author | 2025-04-29 15:32:58 -0400 | |
|---|---|---|
| committer | 2025-04-29 15:32:58 -0400 | |
| commit | 35f18e584fae890f686eafcdc12a2fde6281206d (patch) | |
| tree | 4006551bfb221e80fb6c9173383ce48f308c4512 /src/DisplayWidth.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/DisplayWidth.zig')
| -rw-r--r-- | src/DisplayWidth.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/DisplayWidth.zig b/src/DisplayWidth.zig index 04e6b0c..8631bd4 100644 --- a/src/DisplayWidth.zig +++ b/src/DisplayWidth.zig | |||
| @@ -59,7 +59,7 @@ pub fn strWidth(self: Self, str: []const u8) usize { | |||
| 59 | 59 | ||
| 60 | test "strWidth" { | 60 | test "strWidth" { |
| 61 | const data = try DisplayWidthData.init(testing.allocator); | 61 | const data = try DisplayWidthData.init(testing.allocator); |
| 62 | defer data.deinit(); | 62 | defer data.deinit(testing.allocator); |
| 63 | const self = Self{ .data = &data }; | 63 | const self = Self{ .data = &data }; |
| 64 | const c0 = options.c0_width orelse 0; | 64 | const c0 = options.c0_width orelse 0; |
| 65 | 65 | ||
| @@ -166,7 +166,7 @@ pub fn center( | |||
| 166 | test "center" { | 166 | test "center" { |
| 167 | const allocator = testing.allocator; | 167 | const allocator = testing.allocator; |
| 168 | const data = try DisplayWidthData.init(allocator); | 168 | const data = try DisplayWidthData.init(allocator); |
| 169 | defer data.deinit(); | 169 | defer data.deinit(allocator); |
| 170 | const self = Self{ .data = &data }; | 170 | const self = Self{ .data = &data }; |
| 171 | 171 | ||
| 172 | // Input and width both have odd length | 172 | // Input and width both have odd length |
| @@ -245,7 +245,7 @@ pub fn padLeft( | |||
| 245 | test "padLeft" { | 245 | test "padLeft" { |
| 246 | const allocator = testing.allocator; | 246 | const allocator = testing.allocator; |
| 247 | const data = try DisplayWidthData.init(allocator); | 247 | const data = try DisplayWidthData.init(allocator); |
| 248 | defer data.deinit(); | 248 | defer data.deinit(allocator); |
| 249 | const self = Self{ .data = &data }; | 249 | const self = Self{ .data = &data }; |
| 250 | 250 | ||
| 251 | var right_aligned = try self.padLeft(allocator, "abc", 9, "*"); | 251 | var right_aligned = try self.padLeft(allocator, "abc", 9, "*"); |
| @@ -295,7 +295,7 @@ pub fn padRight( | |||
| 295 | test "padRight" { | 295 | test "padRight" { |
| 296 | const allocator = testing.allocator; | 296 | const allocator = testing.allocator; |
| 297 | const data = try DisplayWidthData.init(allocator); | 297 | const data = try DisplayWidthData.init(allocator); |
| 298 | defer data.deinit(); | 298 | defer data.deinit(allocator); |
| 299 | const self = Self{ .data = &data }; | 299 | const self = Self{ .data = &data }; |
| 300 | 300 | ||
| 301 | var left_aligned = try self.padRight(allocator, "abc", 9, "*"); | 301 | var left_aligned = try self.padRight(allocator, "abc", 9, "*"); |
| @@ -348,7 +348,7 @@ pub fn wrap( | |||
| 348 | test "wrap" { | 348 | test "wrap" { |
| 349 | const allocator = testing.allocator; | 349 | const allocator = testing.allocator; |
| 350 | const data = try DisplayWidthData.init(allocator); | 350 | const data = try DisplayWidthData.init(allocator); |
| 351 | defer data.deinit(); | 351 | defer data.deinit(allocator); |
| 352 | const self = Self{ .data = &data }; | 352 | const self = Self{ .data = &data }; |
| 353 | 353 | ||
| 354 | const input = "The quick brown fox\r\njumped over the lazy dog!"; | 354 | const input = "The quick brown fox\r\njumped over the lazy dog!"; |