annotate src/testdir/test82.in @ 3976:67e3b2753a6e v7.3.743

updated for version 7.3.743 Problem: Tiny build still fails. Solution: Add #else in the right place.
author Bram Moolenaar <bram@vim.org>
date Wed, 28 Nov 2012 23:03:07 +0100
parents f2de38a019a2
children 46cf49cc9289
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2965
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 STARTTEST
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 :so small.vim
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5 :if !has("multi_byte")
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 : e! test.ok
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 : w! test.out
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 : qa!
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 :endif
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 :set enc=utf8
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 ggdG
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 :function! Ch(a, op, b, expected)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 : if eval(printf('"%s" %s "%s"', a:a, a:op, a:b)) != a:expected
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 : call append(line('$'), printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 : else
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 : let b:passed += 1
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 : endif
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 :function! Chk(a, b, result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 : if a:result == 0
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 : call Ch(a:a, '==?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 : call Ch(a:a, '!=?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 : call Ch(a:a, '<=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 : call Ch(a:a, '>=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 : call Ch(a:a, '<?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 : call Ch(a:a, '>?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 : elseif a:result > 0
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 : call Ch(a:a, '==?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 : call Ch(a:a, '!=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 : call Ch(a:a, '<=?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 : call Ch(a:a, '>=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 : call Ch(a:a, '<?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 : call Ch(a:a, '>?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 : else
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 : call Ch(a:a, '==?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 : call Ch(a:a, '!=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 : call Ch(a:a, '<=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 : call Ch(a:a, '>=?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 : call Ch(a:a, '<?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 : call Ch(a:a, '>?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 : endif
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 :function! Check(a, b, result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 : call Chk(a:a, a:b, a:result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 : call Chk(a:b, a:a, -a:result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 :function! LT(a, b)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 : call Check(a:a, a:b, -1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 :function! GT(a, b)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 : call Check(a:a, a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 :function! EQ(a, b)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 : call Check(a:a, a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 :let b:passed=0
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 :call EQ('', '')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 :call LT('', 'a')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 :call EQ('abc', 'abc')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 :call EQ('Abc', 'abC')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 :call LT('ab', 'abc')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 :call LT('AB', 'abc')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 :call LT('ab', 'aBc')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 :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')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 :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')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 :call EQ('\xe2\x84\xaa', 'k')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 :call LT('\xe2\x84\xaa', 'kkkkkk')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 :call EQ('\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa', 'kkk')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 :call LT('kk', '\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 :call EQ('\xe2\x84\xaa\xe2\x84\xa6k\xe2\x84\xaak\xcf\x89', 'k\xcf\x89\xe2\x84\xaakk\xe2\x84\xa6')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 :call EQ('Abc\x80', 'AbC\x80')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 :call LT('Abc\x80', 'AbC\x81')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 :call LT('Abc', 'AbC\x80')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 :call LT('abc\x80DEF', 'abc\x80def') " case folding stops at the first bad character
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 :call LT('\xc3XYZ', '\xc3xyz')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 :call EQ('\xef\xbc\xba', '\xef\xbd\x9a') " FF3A (upper), FF5A (lower)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 :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
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 :call LT('\xc3', '\xc3\x83')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86 :call EQ('\xc3\xa3xYz', '\xc3\x83XyZ')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 :for n in range(0x60, 0xFF) | call LT(printf('xYz\x%.2X', n-1), printf('XyZ\x%.2X', n)) | endfor
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 :for n in range(0x80, 0xBF) | call EQ(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 :for n in range(0xC0, 0xFF) | call LT(printf('xYz\xc2\x%.2XUvW', n), printf('XyZ\xc2\x%.2XuVw', n)) | endfor
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 :call append(0, printf('%d checks passed', b:passed))
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 :wq! test.out
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92 ENDTEST
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93