Hi Bram,

Sorry, I couldn't notice existence of 'src/testdir/test_expr_utf8.vim'.
I updated this patch. Please check it.

Best regards,
Naruhiko Nishino (a.k.a. rbtnn)

2016-04-15 0:37 GMT+09:00 Naruhiko Nishino <[email protected]>:
> Hi Bram,
>
> It still does not work in the case below.
>
> Actual:
>   echo nr2char(strgetchar('あaい', 0))
>   " あ
>   echo nr2char(strgetchar('あaい', 1))
>   " <82>
>   echo nr2char(strgetchar('あaい', 2))
>   " い
>
> Expected:
>   echo nr2char(strgetchar('あaい', 0))
>   " あ
>   echo nr2char(strgetchar('あaい', 1))
>   " a
>   echo nr2char(strgetchar('あaい', 2))
>   " い
>
> I wrote this patch. Please check it.
>
> Best regards,
> Naruhiko Nishino (a.k.a. rbtnn)
>
> 2016-04-15 0:21 GMT+09:00  <[email protected]>:
>> On Thursday, April 14, 2016 at 4:57:33 PM UTC+2, Bram Moolenaar wrote:
>>> 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 -- [email protected] -- 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    ///
>>
>> The wrong part was moved to Test_strgetchar function in test_expr_utf8.vim.
>> It should be:
>>
>> func Test_strgetchar()
>>   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
>>
>> (with the á and à characters)
>>
>> --
>> --
>> You received this message from the "vim_dev" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "vim_dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: diff.patch
Description: Binary data

Raspunde prin e-mail lui