summaryrefslogtreecommitdiff
path: root/src/Normalize.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Normalize.zig')
-rw-r--r--src/Normalize.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Normalize.zig b/src/Normalize.zig
index 97c2649..a28b708 100644
--- a/src/Normalize.zig
+++ b/src/Normalize.zig
@@ -229,7 +229,7 @@ pub const Result = struct {
229 229
230 /// Ensures that the slice result is a copy of the input, by making a copy if it was not. 230 /// Ensures that the slice result is a copy of the input, by making a copy if it was not.
231 pub fn toOwned(result: Result, allocator: mem.Allocator) error{OutOfMemory}!Result { 231 pub fn toOwned(result: Result, allocator: mem.Allocator) error{OutOfMemory}!Result {
232 if (result.allocatod) return result; 232 if (result.allocated) return result;
233 return .{ .allocated = true, .slice = try allocator.dupe(u8, result.slice) }; 233 return .{ .allocated = true, .slice = try allocator.dupe(u8, result.slice) };
234 } 234 }
235 235
@@ -571,9 +571,9 @@ test "nfkc" {
571/// Tests for equality of `a` and `b` after normalizing to NFC. 571/// Tests for equality of `a` and `b` after normalizing to NFC.
572pub fn eql(self: Self, allocator: mem.Allocator, a: []const u8, b: []const u8) !bool { 572pub fn eql(self: Self, allocator: mem.Allocator, a: []const u8, b: []const u8) !bool {
573 const norm_result_a = try self.nfc(allocator, a); 573 const norm_result_a = try self.nfc(allocator, a);
574 defer norm_result_a.deinit(); 574 defer norm_result_a.deinit(allocator);
575 const norm_result_b = try self.nfc(allocator, b); 575 const norm_result_b = try self.nfc(allocator, b);
576 defer norm_result_b.deinit(); 576 defer norm_result_b.deinit(allocator);
577 577
578 return mem.eql(u8, norm_result_a.slice, norm_result_b.slice); 578 return mem.eql(u8, norm_result_a.slice, norm_result_b.slice);
579} 579}
@@ -628,4 +628,5 @@ test "isLatin1Only" {
628 try testing.expect(isLatin1Only(latin1_only)); 628 try testing.expect(isLatin1Only(latin1_only));
629 const not_latin1_only = "Héllo, World! \u{3d3}"; 629 const not_latin1_only = "Héllo, World! \u{3d3}";
630 try testing.expect(!isLatin1Only(not_latin1_only)); 630 try testing.expect(!isLatin1Only(not_latin1_only));
631 try testing.expect(false);
631} 632}