Mercurial > vim
comparison src/testdir/test_functions.vim @ 20313:244eb8d8d100 v8.2.0712
patch 8.2.0712: various code not fully tested
Commit: https://github.com/vim/vim/commit/0ff5dedf0f69e56320199db7a2aad46be2a1f9b7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 7 18:43:44 2020 +0200
patch 8.2.0712: various code not fully tested
Problem: Various code not fully tested.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6049)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 07 May 2020 18:45:04 +0200 |
parents | 2fb397573541 |
children | 9fd5414e294c |
comparison
equal
deleted
inserted
replaced
20312:0742d56da9b2 | 20313:244eb8d8d100 |
---|---|
568 | 568 |
569 " This call to tolower with invalid utf8 sequence used to cause access to | 569 " This call to tolower with invalid utf8 sequence used to cause access to |
570 " invalid memory. | 570 " invalid memory. |
571 call tolower("\xC0\x80\xC0") | 571 call tolower("\xC0\x80\xC0") |
572 call tolower("123\xC0\x80\xC0") | 572 call tolower("123\xC0\x80\xC0") |
573 | |
574 " Test in latin1 encoding | |
575 let save_enc = &encoding | |
576 set encoding=latin1 | |
577 call assert_equal("abc", tolower("ABC")) | |
578 let &encoding = save_enc | |
573 endfunc | 579 endfunc |
574 | 580 |
575 func Test_toupper() | 581 func Test_toupper() |
576 call assert_equal("", toupper("")) | 582 call assert_equal("", toupper("")) |
577 | 583 |
639 | 645 |
640 " This call to toupper with invalid utf8 sequence used to cause access to | 646 " This call to toupper with invalid utf8 sequence used to cause access to |
641 " invalid memory. | 647 " invalid memory. |
642 call toupper("\xC0\x80\xC0") | 648 call toupper("\xC0\x80\xC0") |
643 call toupper("123\xC0\x80\xC0") | 649 call toupper("123\xC0\x80\xC0") |
650 | |
651 " Test in latin1 encoding | |
652 let save_enc = &encoding | |
653 set encoding=latin1 | |
654 call assert_equal("ABC", toupper("abc")) | |
655 let &encoding = save_enc | |
644 endfunc | 656 endfunc |
645 | 657 |
646 func Test_tr() | 658 func Test_tr() |
647 call assert_equal('foo', tr('bar', 'bar', 'foo')) | 659 call assert_equal('foo', tr('bar', 'bar', 'foo')) |
648 call assert_equal('zxy', 'cab'->tr('abc', 'xyz')) | 660 call assert_equal('zxy', 'cab'->tr('abc', 'xyz')) |
1158 call assert_notequal(0, setfperm('Xfilewritable', 'rw-r-----')) | 1170 call assert_notequal(0, setfperm('Xfilewritable', 'rw-r-----')) |
1159 call assert_equal(1, 'Xfilewritable'->filewritable()) | 1171 call assert_equal(1, 'Xfilewritable'->filewritable()) |
1160 | 1172 |
1161 call assert_equal(0, filewritable('doesnotexist')) | 1173 call assert_equal(0, filewritable('doesnotexist')) |
1162 | 1174 |
1175 call mkdir('Xdir') | |
1176 call assert_equal(2, filewritable('Xdir')) | |
1177 call delete('Xdir', 'd') | |
1178 | |
1163 call delete('Xfilewritable') | 1179 call delete('Xfilewritable') |
1164 bw! | 1180 bw! |
1165 endfunc | 1181 endfunc |
1166 | 1182 |
1167 func Test_Executable() | 1183 func Test_Executable() |