mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-21 23:05:20 +00:00
terminal: add tests for incomplete utf-8, fix one bug
This commit is contained in:
@@ -119,3 +119,20 @@ test "decode invalid UTF-8" {
|
||||
|
||||
try testing.expectEqual(@as(u32, 0xFFFD), output[5]);
|
||||
}
|
||||
|
||||
// This is testing our current behavior so that we know we have to handle
|
||||
// this case in terminal/stream.zig. If we change this behavior, we can
|
||||
// remove the special handling in terminal/stream.zig.
|
||||
test "decode invalid leading byte isn't consumed or replaced" {
|
||||
const testing = std.testing;
|
||||
|
||||
var output: [64]u32 = undefined;
|
||||
|
||||
{
|
||||
const str = "hello\xFF";
|
||||
try testing.expectEqual(DecodeResult{
|
||||
.consumed = 5,
|
||||
.decoded = 5,
|
||||
}, utf8DecodeUntilControlSeq(str, &output));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user