To: vim_dev@googlegroups.com Subject: Patch 8.1.0008 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0008 Problem: No test for strwidth(). Solution: Add a test. (Dominique Pelle, closes #2931) Files: src/testdir/test_functions.vim *** ../vim-8.1.0007/src/testdir/test_functions.vim 2018-03-22 22:48:20.000000000 +0100 --- src/testdir/test_functions.vim 2018-05-20 14:09:31.346367348 +0200 *************** *** 96,101 **** --- 96,125 ---- call assert_fails('call min(v:none)', 'E712:') endfunc + func Test_strwidth() + for aw in ['single', 'double'] + exe 'set ambiwidth=' . aw + call assert_equal(0, strwidth('')) + call assert_equal(1, strwidth("\t")) + call assert_equal(3, strwidth('Vim')) + call assert_equal(4, strwidth(1234)) + call assert_equal(5, strwidth(-1234)) + + if has('multi_byte') + call assert_equal(2, strwidth('😉')) + call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde')) + call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße')) + endif + + call assert_fails('call strwidth({->0})', 'E729:') + call assert_fails('call strwidth([])', 'E730:') + call assert_fails('call strwidth({})', 'E731:') + call assert_fails('call strwidth(1.2)', 'E806:') + endfor + + set ambiwidth& + endfunc + func Test_str2nr() call assert_equal(0, str2nr('')) call assert_equal(1, str2nr('1')) *** ../vim-8.1.0007/src/version.c 2018-05-20 14:06:34.506186527 +0200 --- src/version.c 2018-05-20 14:10:31.208184912 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 8, /**/ -- ARTHUR: The swallow may fly south with the sun, or the house martin or the plover seek warmer hot lands in winter, yet these are not strangers to our land. SOLDIER: Are you suggesting coconuts migrate? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///