To: vim_dev@googlegroups.com Subject: Patch 7.4.1734 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1734 (after 7.4.1730) Problem: Test fails when not using utf-8. Solution: Split test in regularand utf-8 part. Files: src/testdir/test_expr.vim, src/testdir/test_expr_utf8.vim, src/testdir/test_alot_utf8.vim *** ../vim-7.4.1733/src/testdir/test_expr.vim 2016-04-14 15:13:41.755917075 +0200 --- src/testdir/test_expr.vim 2016-04-14 16:53:37.761495832 +0200 *************** *** 59,75 **** call assert_equal(-1, strgetchar('axb', -1)) call assert_equal(-1, strgetchar('axb', 3)) call assert_equal(-1, strgetchar('', 0)) - - if !has('multi_byte') - return - endif - - call assert_equal(char2nr('á'), strgetchar('áxb', 0)) - call assert_equal(char2nr('x'), strgetchar('áxb', 1)) - - call assert_equal(char2nr('a'), strgetchar('àxb', 0)) - call assert_equal(char2nr('̀'), strgetchar('àxb', 1)) - call assert_equal(char2nr('x'), strgetchar('àxb', 2)) endfunc func Test_strcharpart() --- 59,64 ---- *************** *** 84,99 **** call assert_equal('', strcharpart('axb', -2, 2)) call assert_equal('a', strcharpart('axb', -1, 2)) - - if !has('multi_byte') - return - endif - - call assert_equal('áxb', strcharpart('áxb', 0)) - call assert_equal('á', strcharpart('áxb', 0, 1)) - call assert_equal('x', strcharpart('áxb', 1, 1)) - - call assert_equal('a', strcharpart('àxb', 0, 1)) - call assert_equal('̀', strcharpart('àxb', 1, 1)) - call assert_equal('x', strcharpart('àxb', 2, 1)) endfunc --- 73,76 ---- *** ../vim-7.4.1733/src/testdir/test_expr_utf8.vim 2016-04-14 16:56:40.371624252 +0200 --- src/testdir/test_expr_utf8.vim 2016-04-14 16:53:39.333479728 +0200 *************** *** 0 **** --- 1,26 ---- + " Tests for expressions using utf-8. + if !has('multi_byte') + finish + endif + set encoding=utf-8 + scriptencoding utf-8 + + func Test_strgetchar() + call assert_equal(char2nr('a'), strgetchar('axb', 0)) + call assert_equal(char2nr('x'), strgetchar('axb', 1)) + call assert_equal(char2nr('b'), strgetchar('axb', 2)) + + call assert_equal(-1, strgetchar('axb', -1)) + call assert_equal(-1, strgetchar('axb', 3)) + call assert_equal(-1, strgetchar('', 0)) + endfunc + + func Test_strcharpart() + call assert_equal('áxb', strcharpart('áxb', 0)) + call assert_equal('á', strcharpart('áxb', 0, 1)) + call assert_equal('x', strcharpart('áxb', 1, 1)) + + call assert_equal('a', strcharpart('àxb', 0, 1)) + call assert_equal('̀', strcharpart('àxb', 1, 1)) + call assert_equal('x', strcharpart('àxb', 2, 1)) + endfunc *** ../vim-7.4.1733/src/testdir/test_alot_utf8.vim 2016-04-03 14:00:29.320148959 +0200 --- src/testdir/test_alot_utf8.vim 2016-04-14 16:52:16.942323610 +0200 *************** *** 4,7 **** --- 4,8 ---- " These tests use utf8 'encoding'. Setting 'encoding' is in the individual " files, so that they can be run by themselves. + source test_expr_utf8.vim source test_regexp_utf8.vim *** ../vim-7.4.1733/src/version.c 2016-04-14 16:45:59.082193177 +0200 --- src/version.c 2016-04-14 16:53:46.561405681 +0200 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1734, /**/ -- In his lifetime van Gogh painted 486 oil paintings. Oddly enough, 8975 of them are to be found in the United States. /// 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 ///