Wednesday, April 15, 2020

Re: Question on test_increment_dbcs.vim

Brian Matthews wrote:

> I'm trying to get vim to compile on my Mac running Mojave and it's
> failing. I've grabbed the latest sources:
>
> $ git reset --hard origin/master
> HEAD is now at 4d5d0dfe9 patch 8.2.0579: Coverity warns for unused value
>
> My configure command is:
>
> ./configure --disable-gui --enable-largefile --enable-multibyte
> --enable-pythoninterp --prefix=/usr/local
>
> make succeeds then make test results in:
>
> Executed:  2870 Tests
>  Skipped:    33 Tests
>   FAILED:     1 Tests
>
>
> Failures:
>     From test_increment_dbcs.vim:
>     Found errors in Test_increment_dbcs_1():
>     function RunTheTest[39]..Test_increment_dbcs_1 line 4: Expected
> ['?R2'] but got ['?S1']
>     function RunTheTest[39]..Test_increment_dbcs_1 line 5: Expected [0,
> 1, 3, 0] but got [0, 1, 2, 0]
>     function RunTheTest[39]..Test_increment_dbcs_1 line 9: Expected
> ['?`?a?b0xDD?e'] but got ['?`?a?b0xDE?e']
>     function RunTheTest[39]..Test_increment_dbcs_1 line 10: Expected
> [0, 1, 10, 0] but got [0, 1, 4, 0]
>
> TEST FAILURE
> make[2]: *** [report] Error 1
> make[1]: *** [scripttests] Error 2
> make: *** [test] Error 2
>
> After studying test_increment_dbcs.vim, it appears it's failing because
> the vim under test isn't recognizing <8e> as "shifting" the next
> character, so in <8e>R1, CTRL-A is incrementing the R (alpha has been
> added to nrformats) as if it's just a regular alphabetical character,
> instead of the 1 (and similarly for the CTRL-X test later in the file),
> while it shouldn't be treating R as alphabetical because the encoding
> has been set to cp932 and it's preceeded by an <8e>.
>
> If I modify the test so it doesn't added alpha to nrformats, it works,
> but for the wrong reason (I think). Does anyone have any idea why it
> might be doing this? For now I've just ignored the failure because it's
> the only one and it's not something I'll ever use (until after I've
> forgotten I've ignored it not working :-) ), but I'd like all the tests
> to actually succeed.

The test sets 'encoding' to "cp932". When you do that, do you get a
warning or error? Vim uses mblen() to decide which bytes start a
double-byte character, perhaps that doesn't work in your case.

We could skip the test if cp932 doesn't work, but we need to detect that
somehow. Perhaps check with strchars()? Can you do this:
:set enc=cp932
:echo strlen("\x8eR")
:echo strchars("\x8eR")

--
Hanson's Treatment of Time:
There are never enough hours in a day, but always too
many days before Saturday.

/// 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 ///

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/202004151906.03FJ60ml013966%40masaka.moolenaar.net.

No comments: