test(strcase_save): test overlong UTF8-encoding

This commit is contained in:
Dundar Göc 2022-03-05 12:18:25 +01:00
parent 4d2744ffe3
commit fff527b88d

View File

@ -138,3 +138,15 @@ describe('vim_strchr()', function()
eq(nil, vim_strchr('«\237\175\191\237\188\128»', 0x10FF00))
end)
end)
describe('strcase_save()' , function()
local strcase_save = function(input_string, upper)
local res = strings.strcase_save(to_cstr(input_string), upper)
return ffi.string(res)
end
itp('decodes overlong encoded characters.', function()
eq("A", strcase_save("\xc1\x81", true))
eq("a", strcase_save("\xc1\x81", false))
end)
end)