diff options
author | Dundar Göc <gocdundar@gmail.com> | 2022-03-05 12:18:25 +0100 |
---|---|---|
committer | Dundar Göc <gocdundar@gmail.com> | 2022-03-05 16:40:03 +0100 |
commit | fff527b88de91b88db95143c470c3e9007dd443e (patch) | |
tree | e8ea606c7574e9e2554628960be245fe5beabf11 | |
parent | 4d2744ffe30c785ff19624831e36d01e3f6a6089 (diff) | |
download | rneovim-fff527b88de91b88db95143c470c3e9007dd443e.tar.gz rneovim-fff527b88de91b88db95143c470c3e9007dd443e.tar.bz2 rneovim-fff527b88de91b88db95143c470c3e9007dd443e.zip |
test(strcase_save): test overlong UTF8-encoding
-rw-r--r-- | test/unit/strings_spec.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index e54c82b26a..e085ac749d 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -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) |