annotate src/testdir/test82.in @ 11545:1780e6fecb30 v8.0.0655

patch 8.0.0655: not easy to make sure a function does not exist commit https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 22 19:15:24 2017 +0200 patch 8.0.0655: not easy to make sure a function does not exist Problem: Not easy to make sure a function does not exist. Solution: Add ! as an optional argument to :delfunc.
author Christian Brabandt <cb@256bit.org>
date Thu, 22 Jun 2017 19:30:04 +0200
parents bc269cf15ccd
children
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)
5288
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
2 Also test "g~ap".
2965
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 STARTTEST
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5 :so small.vim
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 :if !has("multi_byte")
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 : e! test.ok
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 : w! test.out
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 : qa!
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 :endif
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 :set enc=utf8
7003
bc269cf15ccd patch 7.4.819
Bram Moolenaar <bram@vim.org>
parents: 5288
diff changeset
12 ggdG:
2965
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 :function! Ch(a, op, b, expected)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 : 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
16 : 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
17 : else
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 : let b:passed += 1
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 : endif
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 :function! Chk(a, b, result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 : if a:result == 0
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24 : call Ch(a:a, '==?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 : call Ch(a:a, '!=?', a:b, 0)
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, 1)
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 : call Ch(a:a, '>?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 : elseif a:result > 0
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 : call Ch(a:a, '==?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 : call Ch(a:a, '!=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 : call Ch(a:a, '<=?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 : call Ch(a:a, '>=?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 : call Ch(a:a, '<?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 : call Ch(a:a, '>?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 : else
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 : call Ch(a:a, '==?', a:b, 0)
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, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 : call Ch(a:a, '>=?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 : call Ch(a:a, '<?', a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 : call Ch(a:a, '>?', a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 : endif
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 :function! Check(a, b, result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 : call Chk(a:a, a:b, a:result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 : call Chk(a:b, a:a, -a:result)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 :function! LT(a, b)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 : call Check(a:a, a:b, -1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 :function! GT(a, b)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 : call Check(a:a, a:b, 1)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 :function! EQ(a, b)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 : call Check(a:a, a:b, 0)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62 :endfunction
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 :
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 :let b:passed=0
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 :call EQ('', '')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 :call LT('', 'a')
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 EQ('Abc', '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 LT('ab', 'aBc')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 :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
73 :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
74 :call EQ('\xe2\x84\xaa', 'k')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 :call LT('\xe2\x84\xaa', 'kkkkkk')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 :call EQ('\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa', 'kkk')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 :call LT('kk', '\xe2\x84\xaa\xe2\x84\xaa\xe2\x84\xaa')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 :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
79 :call EQ('Abc\x80', 'AbC\x80')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 :call LT('Abc\x80', 'AbC\x81')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 :call LT('Abc', 'AbC\x80')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 :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
83 :call LT('\xc3XYZ', '\xc3xyz')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 :call EQ('\xef\xbc\xba', '\xef\xbd\x9a') " FF3A (upper), FF5A (lower)
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 :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
86 :call LT('\xc3', '\xc3\x83')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
87 :call EQ('\xc3\xa3xYz', '\xc3\x83XyZ')
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88 :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
89 :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
90 :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
91 :call append(0, printf('%d checks passed', b:passed))
5288
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
92 :"
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
93 :" test that g~ap changes one paragraph only.
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
94 :new
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
95 iabcd
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
96
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
97 defggg0g~ap:let lns = getline(1,3)
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
98 :q!
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
99 :call append(line('$'), lns)
46cf49cc9289 updated for version 7.4b.020
Bram Moolenaar <bram@vim.org>
parents: 2965
diff changeset
100 :"
2965
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101 :wq! test.out
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 ENDTEST
f2de38a019a2 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
103