Mercurial > vim
view src/testdir/test_utf8_comparisons.vim @ 33988:7c30841c60a0 v9.0.2180
patch 9.0.2180: POSIX function name in exarg causes issues
Commit: https://github.com/vim/vim/commit/6fdb6280821a822768df5689a5d727e37d38306c
Author: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
Date: Tue Dec 19 20:53:07 2023 +0100
patch 9.0.2180: POSIX function name in exarg causes issues
Problem: POSIX function name in exarg struct causes issues
on OpenVMS
Solution: Rename getline member in exarg struct to ea_getline,
remove isinf() workaround for VMS
There are compilers that do not treat well POSIX functions - like
getline - usage in the structs.
Older VMS compilers could digest this... but the newer OpenVMS compilers
( like VSI C x86-64 X7.4-843 (GEM 50XB9) ) cannot deal with these
structs. This could be limited to getline() that is defined via
getdelim() and might not affect all POSIX functions in general - but
avoiding POSIX function names usage in the structs is a "safe side"
practice without compromising the functionality or the code readability.
The previous OpenVMS X86 port used a workaround limiting the compiler
capabilities using __CRTL_VER_OVERRIDE=80400000
In order to make the OpenVMS port future proof, this pull request
proposes a possible solution.
closes: #13704
Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2023 21:00:04 +0100 |
parents | 08940efa6b4e |
children | d2ad8733db75 |
line wrap: on
line source
" Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c) " Also test "g~ap". func Ch(a, op, b, expected) call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected, \ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected)) endfunc func Chk(a, b, result) if a:result == 0 call Ch(a:a, '==?', a:b, 1) call Ch(a:a, '!=?', a:b, 0) call Ch(a:a, '<=?', a:b, 1) call Ch(a:a, '>=?', a:b, 1) call Ch(a:a, '<?', a:b, 0) call Ch(a:a, '>?', a:b, 0) elseif a:result > 0 call Ch(a:a, '==?', a:b, 0) call Ch(a:a, '!=?', a:b, 1) call Ch(a:a, '<=?', a:b, 0) call Ch(a:a, '>=?', a:b, 1) call Ch(a:a, '<?', a:b, 0) call Ch(a:a, '>?', a:b, 1) else call Ch(a:a, '==?', a:b, 0) call Ch(a:a, '!=?', a:b, 1) call Ch(a:a, '<=?', a:b, 1) call Ch(a:a, '>=?', a:b, 0) call Ch(a:a, '<?', a:b, 1) call Ch(a:a, '>?', a:b, 0) endif endfunc func Check(a, b, result) call Chk(a:a, a:b, a:result) call Chk(a:b, a:a, -a:result) endfunc func LT(a, b) call Check(a:a, a:b, -1) endfunc func GT(a, b) call Check(a:a, a:b, 1) endfunc func EQ(a, b) call Check(a:a, a:b, 0) endfunc func Test_comparisons() call EQ('', '') call LT('', 'a') call EQ('abc', 'abc') call EQ('Abc', 'abC') call LT('ab', 'abc') call LT('AB', 'abc') call LT('ab', 'aBc') call EQ('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xb9\xd0\xa6\xd0\xa3\xd0\xba\xd0\x95\xd0\xbd') call LT('\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd', '\xd0\xaf\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd') call EQ('\xe2\x84\xaa', 'k') call LT('\xe2\x84\xaa', 'kkkkkk') call EQ('\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa', 'kkk') call LT('kk', '\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa') call EQ('\xe2\x84\xaa\xe2\x84\xa6k\xe2\x84\xaak\xcf\x89', 'k\xcf\x89\xe2\x84\xaakk\xe2\x84\xa6') call EQ('Abc\x80', 'AbC\x80') call LT('Abc\x80', 'AbC\x81') call LT('Abc', 'AbC\x80') call LT('abc\x80DEF', 'abc\x80def') " case folding stops at the first bad character call LT('\xc3XYZ', '\xc3xyz') call EQ('\xef\xbc\xba', '\xef\xbd\x9a') " FF3A (upper), FF5A (lower) call GT('\xef\xbc\xba', '\xef\xbc\xff') " first string is ok and equals \xef\xbd\x9a after folding, second string is illegal and was left unchanged, then the strings were bytewise compared call LT('\xc3', '\xc3\x83') call EQ('\xc3\xa3xYz', '\xc3\x83XyZ') for n in range(0x60, 0xFF) call LT(printf('xYz\x%.2X', n-1), printf('XyZ\x%.2X', n)) endfor for n in range(0x80, 0xBF) call EQ(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) endfor for n in range(0xC0, 0xFF) call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) endfor endfunc " test that g~ap changes one paragraph only. func Test_gap() new " setup text call feedkeys("iabcd\<cr>\<cr>defg", "tx") " modify only first line call feedkeys("gg0g~ap", "tx") call assert_equal(["ABCD", "", "defg"], getline(1,3)) endfunc " vim: shiftwidth=2 sts=2 expandtab