diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-22 19:12:48 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-22 19:12:48 +0100 |
commit | 235cf0b2beafa177e7fa74ad6cc099ffbe5ec65f (patch) | |
tree | 432aa0ded0dbb5d77d24c48429b54cb3a00cb841 /test/basic.nim | |
parent | b3fa4b34b3c605ca9a6564493139e5ef1949dc73 (diff) | |
download | chawan-235cf0b2beafa177e7fa74ad6cc099ffbe5ec65f.tar.gz |
Make validator actually work
The API made little sense; `n' was being set almost randomly to "some byte at the current position."
Diffstat (limited to 'test/basic.nim')
-rw-r--r-- | test/basic.nim | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/basic.nim b/test/basic.nim index 99ca5c56..fb75eba5 100644 --- a/test/basic.nim +++ b/test/basic.nim @@ -26,13 +26,11 @@ test "validate UTF-8 in parts": var r = uv.validate(ss0.toOpenArrayByte(0, ss0.high), n) # read Hell (0xC3 is not consumed yet) check r == tvrDone - check n == ss0.len + check n == 3 let ss1 = "\xB6, world!\xC3" # read 0xB6 + , world! => Hellö world! check uv.validate(ss1.toOpenArrayByte(0, ss1.high), n) == tvrDone - check n == ss1.len - # finish - check uv.finish() == tvrError + check n == ss1.high - 1 test "validate valid UTF-8": const utf8_valid = [ |