annotate src/testdir/test_spellfile.vim @ 26254:3a13efec0016 v8.2.3658

patch 8.2.3658: duplicate code in xxd Commit: https://github.com/vim/vim/commit/48608b4a4bfab4b9c0c9199d57b7e876c56db74c Author: DungSaga <dungsaga@users.noreply.github.com> Date: Wed Nov 24 11:18:07 2021 +0000 patch 8.2.3658: duplicate code in xxd Problem: Duplicate code in xxd. Solution: Merge duplicated code. Add more tests. (closes https://github.com/vim/vim/issues/9192)
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Nov 2021 12:30:04 +0100
parents 485c7c4afeb7
children 5233acfa06f1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17682
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test for commands that operate on the spellfile.
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 source shared.vim
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source check.vim
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 CheckFeature spell
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 CheckFeature syntax
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 func Test_spell_normal()
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 new
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 call append(0, ['1 good', '2 goood', '3 goood'])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 set spell spellfile=./Xspellfile.add spelllang=en
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let oldlang=v:lang
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 lang C
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " Test for zg
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 1
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 norm! ]s
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 call assert_equal('2 goood', getline('.'))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 norm! zg
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 1
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 let a=execute('unsilent :norm! ]s')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 call assert_equal('1 good', getline('.'))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 call assert_equal('search hit BOTTOM, continuing at TOP', a[1:])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call assert_equal('goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
28 " zg should fail in operator-pending mode
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
29 call assert_beeps('norm! czg')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
30
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
31 " zg fails in visual mode when not able to get the visual text
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
32 call assert_beeps('norm! ggVjzg')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
33 norm! V
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
34
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
35 " zg fails for a non-identifier word
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
36 call append(line('$'), '###')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
37 call assert_fails('norm! Gzg', 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
38 $d
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22220
diff changeset
39
17682
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 " Test for zw
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 norm! $zw
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 1
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 norm! ]s
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 call assert_equal('2 goood', getline('.'))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call assert_equal('#oood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 call assert_equal('goood/!', cnt[1])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 " Test for :spellrare
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 spellrare rare
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 call assert_equal(['#oood', 'goood/!', 'rare/?'], cnt)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 " Make sure :spellundo works for rare words.
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 spellundo rare
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call assert_equal(['#oood', 'goood/!', '#are/?'], cnt)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 " Test for zg in visual mode
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 let a=execute('unsilent :norm! V$zg')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 call assert_equal("Word '2 goood' added to ./Xspellfile.add", a[1:])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 1
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 norm! ]s
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call assert_equal('3 goood', getline('.'))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 call assert_equal('2 goood', cnt[3])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 " Remove "2 good" from spellfile
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 let a=execute('unsilent norm! V$zw')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 call assert_equal("Word '2 goood' added to ./Xspellfile.add", a[1:])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 call assert_equal('2 goood/!', cnt[4])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 " Test for zG
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 let a=execute('unsilent norm! V$zG')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 call assert_match("Word '2 goood' added to .*", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 let fname=matchstr(a, 'to\s\+\zs\f\+$')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 let cnt=readfile(fname)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 call assert_equal('2 goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 " Test for zW
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 let a=execute('unsilent norm! V$zW')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 call assert_match("Word '2 goood' added to .*", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 let cnt=readfile(fname)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 call assert_equal('# goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 call assert_equal('2 goood/!', cnt[1])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 " Test for zuW
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 let a=execute('unsilent norm! V$zuW')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 call assert_match("Word '2 goood' removed from .*", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 let cnt=readfile(fname)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 call assert_equal('# goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 call assert_equal('# goood/!', cnt[1])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 " Test for zuG
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 let a=execute('unsilent norm! $zG')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 call assert_match("Word 'goood' added to .*", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 let cnt=readfile(fname)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 call assert_equal('# goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 call assert_equal('# goood/!', cnt[1])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call assert_equal('goood', cnt[2])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 let a=execute('unsilent norm! $zuG')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 let cnt=readfile(fname)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 call assert_match("Word 'goood' removed from .*", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 call assert_equal('# goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 call assert_equal('# goood/!', cnt[1])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 call assert_equal('#oood', cnt[2])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 " word not found in wordlist
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 let a=execute('unsilent norm! V$zuG')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 let cnt=readfile(fname)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 call assert_match("", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 call assert_equal('# goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 call assert_equal('# goood/!', cnt[1])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 call assert_equal('#oood', cnt[2])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 " Test for zug
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 call delete('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 let a=execute('unsilent norm! $zg')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 call assert_equal('goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 let a=execute('unsilent norm! $zug')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 call assert_match("Word 'goood' removed from \./Xspellfile.add", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 call assert_equal('#oood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 " word not in wordlist
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 let a=execute('unsilent norm! V$zug')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 call assert_match('', a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 call assert_equal('#oood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 " Test for zuw
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 call delete('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 let a=execute('unsilent norm! Vzw')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 call assert_equal('2 goood/!', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 let a=execute('unsilent norm! Vzuw')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 call assert_match("Word '2 goood' removed from \./Xspellfile.add", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 call assert_equal('# goood/!', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 " word not in wordlist
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 let a=execute('unsilent norm! $zug')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 call assert_match('', a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 let cnt=readfile('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 call assert_equal('# goood/!', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 " add second entry to spellfile setting
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 set spellfile=./Xspellfile.add,./Xspellfile2.add
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 call delete('./Xspellfile.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 let a=execute('unsilent norm! $2zg')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 let cnt=readfile('./Xspellfile2.add')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 call assert_match("Word 'goood' added to ./Xspellfile2.add", a)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 call assert_equal('goood', cnt[0])
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 " Test for :spellgood!
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 let temp = execute(':spe!0/0')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 call assert_match('Invalid region', temp)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 let spellfile = matchstr(temp, 'Invalid region nr in \zs.*\ze line \d: 0')
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 call assert_equal(['# goood', '# goood/!', '#oood', '0/0'], readfile(spellfile))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 " Test for :spellrare!
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 :spellrare! raare
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 call assert_equal(['# goood', '# goood/!', '#oood', '0/0', 'raare/?'], readfile(spellfile))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 call delete(spellfile)
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 " clean up
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 exe "lang" oldlang
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 call delete("./Xspellfile.add")
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 call delete("./Xspellfile2.add")
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 call delete("./Xspellfile.add.spl")
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 call delete("./Xspellfile2.add.spl")
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 " zux -> no-op
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 2
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 norm! $zux
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 call assert_equal([], glob('Xspellfile.add',0,1))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 call assert_equal([], glob('Xspellfile2.add',0,1))
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
182 set spellfile= spell& spelllang&
17682
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 bw!
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
185
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
186 " Spell file content test. Write 'content' to the spell file prefixed by the
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
187 " spell file header and then enable spell checking. If 'emsg' is not empty,
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
188 " then check for error.
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
189 func Spellfile_Test(content, emsg)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
190 let splfile = './Xtest/spell/Xtest.utf-8.spl'
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
191 " Add the spell file header and version (VIMspell2)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
192 let v = 0z56494D7370656C6C32 + a:content
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
193 call writefile(v, splfile, 'b')
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
194
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
195 " 'encoding' is set before each test to clear the previously loaded suggest
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
196 " file from memory.
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
197 set encoding=utf-8
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
198
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
199 set runtimepath=./Xtest
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
200 set spelllang=Xtest
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
201 if a:emsg != ''
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
202 call assert_fails('set spell', a:emsg)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
203 else
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
204 " FIXME: With some invalid spellfile contents, there are no error
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
205 " messages. So don't know how to check for the test result.
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
206 set spell
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
207 endif
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
208 set nospell spelllang& rtp&
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
209 endfunc
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
210
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
211 " Test for spell file format errors.
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
212 " The spell file format is described in spellfile.c
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
213 func Test_spellfile_format_error()
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
214 let save_rtp = &rtp
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
215 call mkdir('Xtest/spell', 'p')
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
216 let splfile = './Xtest/spell/Xtest.utf-8.spl'
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
217
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
218 " empty spell file
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
219 call writefile([], splfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
220 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
221 set spelllang=Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
222 call assert_fails('set spell', 'E757:')
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
223 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
224
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
225 " invalid file ID
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
226 call writefile(0z56494D, splfile, 'b')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
227 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
228 set spelllang=Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
229 call assert_fails('set spell', 'E757:')
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
230 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
231
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
232 " missing version number
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
233 call writefile(0z56494D7370656C6C, splfile, 'b')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
234 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
235 set spelllang=Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
236 call assert_fails('set spell', 'E771:')
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
237 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
238
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
239 " invalid version number
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
240 call writefile(0z56494D7370656C6C7A, splfile, 'b')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
241 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
242 set spelllang=Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
243 call assert_fails('set spell', 'E772:')
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
244 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
245
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
246 " no sections
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
247 call Spellfile_Test(0z, 'E758:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
248
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
249 " missing section length
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
250 call Spellfile_Test(0z00, 'E758:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
251
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
252 " unsupported required section
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
253 call Spellfile_Test(0z7A0100000004, 'E770:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
254
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
255 " unsupported not-required section
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
256 call Spellfile_Test(0z7A0000000004, 'E758:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
257
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
258 " SN_REGION: invalid number of region names
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
259 call Spellfile_Test(0z0000000000FF, 'E759:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
260
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
261 " SN_CHARFLAGS: missing <charflagslen> length
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
262 call Spellfile_Test(0z010000000004, 'E758:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
263
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
264 " SN_CHARFLAGS: invalid <charflagslen> length
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
265 call Spellfile_Test(0z0100000000010201, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
266
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
267 " SN_CHARFLAGS: charflagslen == 0 and folcharslen != 0
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
268 call Spellfile_Test(0z01000000000400000101, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
269
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
270 " SN_CHARFLAGS: missing <folcharslen> length
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
271 call Spellfile_Test(0z01000000000100, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
272
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
273 " SN_PREFCOND: invalid prefcondcnt
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
274 call Spellfile_Test(0z03000000000100, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
275
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
276 " SN_PREFCOND: invalid condlen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
277 call Spellfile_Test(0z0300000000020001, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
278
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
279 " SN_REP: invalid repcount
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
280 call Spellfile_Test(0z04000000000100, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
281
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
282 " SN_REP: missing rep
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
283 call Spellfile_Test(0z0400000000020004, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
284
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
285 " SN_REP: zero repfromlen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
286 call Spellfile_Test(0z040000000003000100, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
287
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
288 " SN_REP: invalid reptolen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
289 call Spellfile_Test(0z0400000000050001014101, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
290
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
291 " SN_REP: zero reptolen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
292 call Spellfile_Test(0z0400000000050001014100, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
293
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
294 " SN_SAL: missing salcount
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
295 call Spellfile_Test(0z05000000000102, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
296
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
297 " SN_SAL: missing salfromlen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
298 call Spellfile_Test(0z050000000003080001, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
299
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
300 " SN_SAL: missing saltolen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
301 call Spellfile_Test(0z0500000000050400010161, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
302
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
303 " SN_WORDS: non-NUL terminated word
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
304 call Spellfile_Test(0z0D000000000376696D, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
305
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
306 " SN_WORDS: very long word
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
307 let v = eval('0z0D000000012C' .. repeat('41', 300))
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
308 call Spellfile_Test(v, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
309
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
310 " SN_SOFO: missing sofofromlen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
311 call Spellfile_Test(0z06000000000100, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
312
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
313 " SN_SOFO: missing sofotolen
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
314 call Spellfile_Test(0z06000000000400016100, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
315
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
316 " SN_SOFO: missing sofoto
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
317 call Spellfile_Test(0z0600000000050001610000, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
318
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
319 " SN_SOFO: empty sofofrom and sofoto
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
320 call Spellfile_Test(0z06000000000400000000FF000000000000000000000000, '')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
321
22220
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
322 " SN_SOFO: multi-byte characters in sofofrom and sofoto
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
323 call Spellfile_Test(0z0600000000080002CF810002CF82FF000000000000000000000000, '')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
324
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
325 " SN_COMPOUND: compmax is less than 2
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
326 call Spellfile_Test(0z08000000000101, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
327
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
328 " SN_COMPOUND: missing compsylmax and other options
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
329 call Spellfile_Test(0z0800000000020401, 'E759:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
330
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
331 " SN_COMPOUND: missing compoptions
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
332 call Spellfile_Test(0z080000000005040101, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
333
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
334 " SN_COMPOUND: missing comppattern
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
335 call Spellfile_Test(0z08000000000704010100000001, 'E758:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
336
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
337 " SN_COMPOUND: incorrect comppatlen
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
338 call Spellfile_Test(0z080000000007040101000000020165, 'E758:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
339
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
340 " SN_INFO: missing info
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
341 call Spellfile_Test(0z0F0000000005040101, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
342
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
343 " SN_MIDWORD: missing midword
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
344 call Spellfile_Test(0z0200000000040102, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
345
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
346 " SN_MAP: missing midword
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
347 call Spellfile_Test(0z0700000000040102, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
348
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
349 " SN_MAP: empty map string
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
350 call Spellfile_Test(0z070000000000FF000000000000000000000000, '')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
351
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
352 " SN_MAP: duplicate multibyte character
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
353 call Spellfile_Test(0z070000000004DC81DC81, 'E783:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
354
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
355 " SN_SYLLABLE: missing SYLLABLE item
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
356 call Spellfile_Test(0z0900000000040102, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
357
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
358 " SN_SYLLABLE: More than SY_MAXLEN size
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
359 let v = eval('0z090000000022612F' .. repeat('62', 32))
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
360 call Spellfile_Test(v, '')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
361
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
362 " LWORDTREE: missing
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
363 call Spellfile_Test(0zFF, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
364
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
365 " LWORDTREE: missing tree node
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
366 call Spellfile_Test(0zFF00000004, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
367
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
368 " LWORDTREE: missing tree node value
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
369 call Spellfile_Test(0zFF0000000402, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
370
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
371 " LWORDTREE: incorrect sibling node count
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
372 call Spellfile_Test(0zFF00000001040000000000000000, 'E759:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
373
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
374 " KWORDTREE: missing tree node
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
375 call Spellfile_Test(0zFF0000000000000004, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
376
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
377 " PREFIXTREE: missing tree node
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
378 call Spellfile_Test(0zFF000000000000000000000004, 'E758:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
379
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
380 " PREFIXTREE: incorrect prefcondnr
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
381 call Spellfile_Test(0zFF000000000000000000000002010200000020, 'E759:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
382
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
383 " PREFIXTREE: invalid nodeidx
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
384 call Spellfile_Test(0zFF00000000000000000000000201010000, 'E759:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
385
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
386 let &rtp = save_rtp
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
387 call delete('Xtest', 'rf')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
388 endfunc
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
389
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
390 " Test for format errors in suggest file
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
391 func Test_sugfile_format_error()
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
392 let save_rtp = &rtp
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
393 call mkdir('Xtest/spell', 'p')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
394 let splfile = './Xtest/spell/Xtest.utf-8.spl'
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
395 let sugfile = './Xtest/spell/Xtest.utf-8.sug'
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
396
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
397 " create an empty spell file with a suggest timestamp
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
398 call writefile(0z56494D7370656C6C320B00000000080000000000000044FF000000000000000000000000, splfile, 'b')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
399
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
400 " 'encoding' is set before each test to clear the previously loaded suggest
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
401 " file from memory.
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
402
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
403 " empty suggest file
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
404 set encoding=utf-8
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
405 call writefile([], sugfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
406 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
407 set spelllang=Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
408 set spell
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
409 call assert_fails("let s = spellsuggest('abc')", 'E778:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
410 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
411
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
412 " zero suggest version
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
413 set encoding=utf-8
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
414 call writefile(0z56494D73756700, sugfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
415 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
416 set spelllang=Xtest
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
417 set spell
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
418 call assert_fails("let s = spellsuggest('abc')", 'E779:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
419 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
420
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
421 " unsupported suggest version
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
422 set encoding=utf-8
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
423 call writefile(0z56494D7375671F, sugfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
424 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
425 set spelllang=Xtest
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
426 set spell
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
427 call assert_fails("let s = spellsuggest('abc')", 'E780:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
428 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
429
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
430 " missing suggest timestamp
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
431 set encoding=utf-8
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
432 call writefile(0z56494D73756701, sugfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
433 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
434 set spelllang=Xtest
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
435 set spell
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
436 call assert_fails("let s = spellsuggest('abc')", 'E781:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
437 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
438
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
439 " incorrect suggest timestamp
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
440 set encoding=utf-8
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
441 call writefile(0z56494D7375670100000000000000FF, sugfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
442 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
443 set spelllang=Xtest
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
444 set spell
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
445 call assert_fails("let s = spellsuggest('abc')", 'E781:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
446 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
447
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
448 " missing suggest wordtree
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
449 set encoding=utf-8
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
450 call writefile(0z56494D737567010000000000000044, sugfile)
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
451 set runtimepath=./Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
452 set spelllang=Xtest
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
453 set spell
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
454 call assert_fails("let s = spellsuggest('abc')", 'E782:')
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
455 set nospell spelllang&
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
456
21947
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
457 " invalid suggest word count in SUGTABLE
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
458 set encoding=utf-8
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
459 call writefile(0z56494D7375670100000000000000440000000022, sugfile)
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
460 set runtimepath=./Xtest
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
461 set spelllang=Xtest
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
462 set spell
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
463 call assert_fails("let s = spellsuggest('abc')", 'E782:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
464 set nospell spelllang&
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
465
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
466 " missing sugline in SUGTABLE
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
467 set encoding=utf-8
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
468 call writefile(0z56494D7375670100000000000000440000000000000005, sugfile)
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
469 set runtimepath=./Xtest
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
470 set spelllang=Xtest
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
471 set spell
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
472 call assert_fails("let s = spellsuggest('abc')", 'E782:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
473 set nospell spelllang&
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
474
21841
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
475 let &rtp = save_rtp
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
476 call delete('Xtest', 'rf')
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
477 endfunc
7a6ca887128d patch 8.2.1470: errors in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
478
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
479 " Test for using :mkspell to create a spell file from a list of words
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
480 func Test_wordlist_dic()
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
481 " duplicate encoding
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
482 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
483 # This is an example word list
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
484
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
485 /encoding=latin1
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
486 /encoding=latin1
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
487 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
488 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
489 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
490 let output = execute('mkspell Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
491 call assert_match('Duplicate /encoding= line ignored in Xwordlist.dic line 4: /encoding=latin1', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
492
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
493 " multiple encoding for a word
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
494 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
495 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
496 /encoding=latin1
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
497 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
498 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
499 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
500 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
501 call assert_match('/encoding= line after word ignored in Xwordlist.dic line 2: /encoding=latin1', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
502
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
503 " unsupported encoding for a word
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
504 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
505 /encoding=Xtest
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
506 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
507 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
508 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
509 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
510 call assert_match('Conversion in Xwordlist.dic not supported: from Xtest to utf-8', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
511
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
512 " duplicate region
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
513 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
514 /regions=usca
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
515 /regions=usca
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
516 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
517 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
518 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
519 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
520 call assert_match('Duplicate /regions= line ignored in Xwordlist.dic line 2: regions=usca', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
521
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
522 " maximum regions
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
523 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
524 /regions=uscauscauscauscausca
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
525 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
526 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
527 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
528 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
529 call assert_match('Too many regions in Xwordlist.dic line 1: uscauscauscauscausca', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
530
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
531 " unsupported '/' value
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
532 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
533 /test=abc
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
534 example
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
535 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
536 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
537 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
538 call assert_match('/ line ignored in Xwordlist.dic line 1: /test=abc', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
539
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
540 " unsupported flag
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
541 let lines =<< trim [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
542 example/+
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
543 [END]
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
544 call writefile(lines, 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
545 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
546 call assert_match('Unrecognized flags in Xwordlist.dic line 1: +', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
547
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
548 " non-ascii word
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
549 call writefile(["ʀʀ"], 'Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
550 let output = execute('mkspell! -ascii Xwordlist.spl Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
551 call assert_match('Ignored 1 words with non-ASCII characters', output)
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
552
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
553 " keep case of a word
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
554 let lines =<< trim [END]
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
555 example/=
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
556 [END]
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
557 call writefile(lines, 'Xwordlist.dic')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
558 let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
559 call assert_match('Compressed keep-case:', output)
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
560
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
561 call delete('Xwordlist.spl')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
562 call delete('Xwordlist.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
563 endfunc
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
564
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
565 " Test for the :mkspell command
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
566 func Test_mkspell()
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
567 call assert_fails('mkspell Xtest_us.spl', 'E751:')
22220
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
568 call assert_fails('mkspell Xtest.spl abc', 'E484:')
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
569 call assert_fails('mkspell a b c d e f g h i j k', 'E754:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
570
22220
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
571 " create a .aff file but not the .dic file
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
572 call writefile([], 'Xtest.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
573 call assert_fails('mkspell Xtest.spl Xtest', 'E484:')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
574 call delete('Xtest.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
575
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
576 call writefile([], 'Xtest.spl')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
577 call writefile([], 'Xtest.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
578 call assert_fails('mkspell Xtest.spl Xtest.dic', 'E13:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
579 call delete('Xtest.spl')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
580 call delete('Xtest.dic')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
581
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
582 call mkdir('Xtest.spl')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
583 call assert_fails('mkspell! Xtest.spl Xtest.dic', 'E17:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
584 call delete('Xtest.spl', 'rf')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
585
24727
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
586 " can't write the .spl file as its directory does not exist
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
587 call writefile([], 'Xtest.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
588 call writefile([], 'Xtest.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
589 call assert_fails('mkspell DOES_NOT_EXIT/Xtest.spl Xtest.dic', 'E484:')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
590 call delete('Xtest.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
591 call delete('Xtest.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
592
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
593 call assert_fails('mkspell en en_US abc_xyz', 'E755:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
594 endfunc
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
595
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
596 " Tests for :mkspell with a .dic and .aff file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
597 func Test_aff_file_format_error()
21947
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
598 " FIXME: For some reason, the :mkspell command below doesn't fail on the
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
599 " MS-Windows CI build. Disable this test on MS-Windows for now.
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
600 CheckNotMSWindows
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
601
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
602 " No word count in .dic file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
603 call writefile([], 'Xtest.dic')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
604 call writefile([], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
605 call assert_fails('mkspell! Xtest.spl Xtest', 'E760:')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
606
21947
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
607 " create a .dic file for the tests below
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
608 call writefile(['1', 'work'], 'Xtest.dic')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
609
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
610 " Invalid encoding in .aff file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
611 call writefile(['# comment', 'SET Xinvalidencoding'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
612 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
613 call assert_match('Conversion in Xtest.aff not supported: from xinvalidencoding', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
614
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
615 " Invalid flag in .aff file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
616 call writefile(['FLAG xxx'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
617 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
618 call assert_match('Invalid value for FLAG in Xtest.aff line 1: xxx', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
619
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
620 " set FLAGS after using flag for an affix
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
621 call writefile(['SFX L Y 1', 'SFX L 0 re [^x]', 'FLAG long'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
622 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
623 call assert_match('FLAG after using flags in Xtest.aff line 3: long', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
624
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
625 " INFO in affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
626 let save_encoding = &encoding
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
627 call mkdir('Xrtp/spell', 'p')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
628 call writefile(['1', 'work'], 'Xrtp/spell/Xtest.dic')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
629 call writefile(['NAME klingon', 'VERSION 1.4', 'AUTHOR Spock'],
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
630 \ 'Xrtp/spell/Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
631 silent mkspell! Xrtp/spell/Xtest.utf-8.spl Xrtp/spell/Xtest
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
632 let save_rtp = &rtp
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
633 set runtimepath=./Xrtp
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
634 set spelllang=Xtest
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
635 set spell
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
636 let output = split(execute('spellinfo'), "\n")
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
637 call assert_equal("NAME klingon", output[1])
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
638 call assert_equal("VERSION 1.4", output[2])
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
639 call assert_equal("AUTHOR Spock", output[3])
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
640 let &rtp = save_rtp
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
641 call delete('Xrtp', 'rf')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
642 set spell& spelllang& spellfile&
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
643 %bw!
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
644 " 'encoding' must be set again to clear the spell file in memory
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
645 let &encoding = save_encoding
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
646
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
647 " COMPOUNDFORBIDFLAG flag after PFX in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
648 call writefile(['PFX L Y 1', 'PFX L 0 re x', 'COMPOUNDFLAG c', 'COMPOUNDFORBIDFLAG x'],
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
649 \ 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
650 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
651 call assert_match('Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in Xtest.aff line 4', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
652
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
653 " COMPOUNDPERMITFLAG flag after PFX in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
654 call writefile(['PFX L Y 1', 'PFX L 0 re x', 'COMPOUNDPERMITFLAG c'],
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
655 \ 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
656 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
657 call assert_match('Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in Xtest.aff line 3', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
658
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
659 " Wrong COMPOUNDRULES flag value in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
660 call writefile(['COMPOUNDRULES a'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
661 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
662 call assert_match('Wrong COMPOUNDRULES value in Xtest.aff line 1: a', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
663
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
664 " Wrong COMPOUNDWORDMAX flag value in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
665 call writefile(['COMPOUNDWORDMAX 0'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
666 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
667 call assert_match('Wrong COMPOUNDWORDMAX value in Xtest.aff line 1: 0', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
668
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
669 " Wrong COMPOUNDMIN flag value in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
670 call writefile(['COMPOUNDMIN 0'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
671 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
672 call assert_match('Wrong COMPOUNDMIN value in Xtest.aff line 1: 0', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
673
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
674 " Wrong COMPOUNDSYLMAX flag value in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
675 call writefile(['COMPOUNDSYLMAX 0'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
676 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
677 call assert_match('Wrong COMPOUNDSYLMAX value in Xtest.aff line 1: 0', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
678
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
679 " Wrong CHECKCOMPOUNDPATTERN flag value in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
680 call writefile(['CHECKCOMPOUNDPATTERN 0'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
681 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
682 call assert_match('Wrong CHECKCOMPOUNDPATTERN value in Xtest.aff line 1: 0', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
683
24758
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
684 " Both compounding and NOBREAK specified
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
685 call writefile(['COMPOUNDFLAG c', 'NOBREAK'], 'Xtest.aff')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
686 let output = execute('mkspell! Xtest.spl Xtest')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
687 call assert_match('Warning: both compounding and NOBREAK specified', output)
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
688
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
689 " Duplicate affix entry in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
690 call writefile(['PFX L Y 1', 'PFX L 0 re x', 'PFX L Y 1', 'PFX L 0 re x'],
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
691 \ 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
692 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
693 call assert_match('Duplicate affix in Xtest.aff line 3: L', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
694
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
695 " Duplicate affix entry in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
696 call writefile(['PFX L Y 1', 'PFX L Y 1'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
697 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
698 call assert_match('Unrecognized or duplicate item in Xtest.aff line 2: PFX', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
699
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
700 " Different combining flags in an affix file
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
701 call writefile(['PFX L Y 1', 'PFX L 0 re x', 'PFX L N 1'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
702 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
703 call assert_match('Different combining flag in continued affix block in Xtest.aff line 3', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
704
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25617
diff changeset
705 " Try to reuse an affix used for BAD flag
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
706 call writefile(['BAD x', 'PFX x Y 1', 'PFX x 0 re x'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
707 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
708 call assert_match('Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in Xtest.aff line 2: x', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
709
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
710 " Trailing characters in an affix entry
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
711 call writefile(['PFX L Y 1 Test', 'PFX L 0 re x'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
712 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
713 call assert_match('Trailing text in Xtest.aff line 1: Test', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
714
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
715 " Trailing characters in an affix entry
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
716 call writefile(['PFX L Y 1', 'PFX L 0 re x Test'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
717 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
718 call assert_match('Trailing text in Xtest.aff line 2: Test', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
719
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
720 " Incorrect combine flag in an affix entry
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
721 call writefile(['PFX L X 1', 'PFX L 0 re x'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
722 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
723 call assert_match('Expected Y or N in Xtest.aff line 1: X', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
724
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
725 " Invalid count for REP item
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
726 call writefile(['REP a'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
727 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
728 call assert_match('Expected REP(SAL) count in Xtest.aff line 1', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
729
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
730 " Trailing characters in REP item
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
731 call writefile(['REP 1', 'REP f ph test'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
732 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
733 call assert_match('Trailing text in Xtest.aff line 2: test', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
734
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
735 " Invalid count for MAP item
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
736 call writefile(['MAP a'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
737 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
738 call assert_match('Expected MAP count in Xtest.aff line 1', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
739
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
740 " Duplicate character in a MAP item
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
741 call writefile(['MAP 2', 'MAP xx', 'MAP yy'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
742 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
743 call assert_match('Duplicate character in MAP in Xtest.aff line 2', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
744
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
745 " Use COMPOUNDSYLMAX without SYLLABLE
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
746 call writefile(['COMPOUNDSYLMAX 2'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
747 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
748 call assert_match('COMPOUNDSYLMAX used without SYLLABLE', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
749
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
750 " Missing SOFOTO
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
751 call writefile(['SOFOFROM abcdef'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
752 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
753 call assert_match('Missing SOFOTO line in Xtest.aff', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
754
21947
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
755 " Length of SOFOFROM and SOFOTO differ
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
756 call writefile(['SOFOFROM abcde', 'SOFOTO ABCD'], 'Xtest.aff')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
757 call assert_fails('mkspell! Xtest.spl Xtest', 'E759:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
758
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
759 " Both SAL and SOFOFROM/SOFOTO items
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
760 call writefile(['SOFOFROM abcd', 'SOFOTO ABCD', 'SAL CIA X'], 'Xtest.aff')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
761 let output = execute('mkspell! Xtest.spl Xtest')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
762 call assert_match('Both SAL and SOFO lines in Xtest.aff', output)
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
763
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
764 " use an alphabet flag when FLAG is num
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
765 call writefile(['FLAG num', 'SFX L Y 1', 'SFX L 0 re [^x]'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
766 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
767 call assert_match('Flag is not a number in Xtest.aff line 2: L', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
768
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
769 " use number and alphabet flag when FLAG is num
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
770 call writefile(['FLAG num', 'SFX 4f Y 1', 'SFX 4f 0 re [^x]'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
771 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
772 call assert_match('Affix name too long in Xtest.aff line 2: 4f', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
773
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
774 " use a single character flag when FLAG is long
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
775 call writefile(['FLAG long', 'SFX L Y 1', 'SFX L 0 re [^x]'], 'Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
776 let output = execute('mkspell! Xtest.spl Xtest')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
777 call assert_match('Illegal flag in Xtest.aff line 2: L', output)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
778
22204
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
779 " missing character in UPP entry. The character table is used only in a
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
780 " non-utf8 encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
781 call writefile(['FOL abc', 'LOW abc', 'UPP A'], 'Xtest.aff')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
782 let save_encoding = &encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
783 set encoding=cp949
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
784 call assert_fails('mkspell! Xtest.spl Xtest', 'E761:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
785 let &encoding = save_encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
786
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
787 " character range doesn't match between FOL and LOW entries
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
788 call writefile(["FOL \u0102bc", 'LOW abc', 'UPP ABC'], 'Xtest.aff')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
789 let save_encoding = &encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
790 set encoding=cp949
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
791 call assert_fails('mkspell! Xtest.spl Xtest', 'E762:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
792 let &encoding = save_encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
793
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
794 " character range doesn't match between FOL and UPP entries
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
795 call writefile(["FOL \u0102bc", "LOW \u0102bc", 'UPP ABC'], 'Xtest.aff')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
796 let save_encoding = &encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
797 set encoding=cp949
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
798 call assert_fails('mkspell! Xtest.spl Xtest', 'E762:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
799 let &encoding = save_encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
800
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
801 " additional characters in LOW and UPP entries
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
802 call writefile(["FOL ab", "LOW abc", 'UPP ABC'], 'Xtest.aff')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
803 let save_encoding = &encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
804 set encoding=cp949
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
805 call assert_fails('mkspell! Xtest.spl Xtest', 'E761:')
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
806 let &encoding = save_encoding
3a28f60258ba patch 8.2.1651: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 21947
diff changeset
807
22220
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
808 " missing UPP entry
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
809 call writefile(["FOL abc", "LOW abc"], 'Xtest.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
810 let save_encoding = &encoding
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
811 set encoding=cp949
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
812 let output = execute('mkspell! Xtest.spl Xtest')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
813 call assert_match('Missing FOL/LOW/UPP line in Xtest.aff', output)
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
814 let &encoding = save_encoding
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
815
21947
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
816 " duplicate word in the .dic file
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
817 call writefile(['2', 'good', 'good', 'good'], 'Xtest.dic')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
818 call writefile(['NAME vim'], 'Xtest.aff')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
819 let output = execute('mkspell! Xtest.spl Xtest')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
820 call assert_match('First duplicate word in Xtest.dic line 3: good', output)
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
821 call assert_match('2 duplicate word(s) in Xtest.dic', output)
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
822
22220
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
823 " use multiple .aff files with different values for COMPOUNDWORDMAX and
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
824 " MIDWORD (number and string)
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
825 call writefile(['1', 'world'], 'Xtest_US.dic')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
826 call writefile(['1', 'world'], 'Xtest_CA.dic')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
827 call writefile(["COMPOUNDWORDMAX 3", "MIDWORD '-"], 'Xtest_US.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
828 call writefile(["COMPOUNDWORDMAX 4", "MIDWORD '="], 'Xtest_CA.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
829 let output = execute('mkspell! Xtest.spl Xtest_US Xtest_CA')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
830 call assert_match('COMPOUNDWORDMAX value differs from what is used in another .aff file', output)
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
831 call assert_match('MIDWORD value differs from what is used in another .aff file', output)
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
832 call delete('Xtest_US.dic')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
833 call delete('Xtest_CA.dic')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
834 call delete('Xtest_US.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
835 call delete('Xtest_CA.aff')
37ad27fa22e7 patch 8.2.1659: spellfile code not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 22204
diff changeset
836
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
837 call delete('Xtest.dic')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
838 call delete('Xtest.aff')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
839 call delete('Xtest.spl')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
840 call delete('Xtest.sug')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
841 endfunc
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
842
21887
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
843 func Test_spell_add_word()
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
844 set spellfile=
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
845 call assert_fails('spellgood abc', 'E764:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
846
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
847 set spellfile=Xtest.utf-8.add
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
848 call assert_fails('2spellgood abc', 'E765:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
849
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
850 edit Xtest.utf-8.add
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
851 call setline(1, 'sample')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
852 call assert_fails('spellgood abc', 'E139:')
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
853 set spellfile&
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
854 %bw!
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
855 endfunc
776c76599617 patch 8.2.1493: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21841
diff changeset
856
24727
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
857 func Test_spellfile_verbose()
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
858 call writefile(['1', 'one'], 'XtestVerbose.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
859 call writefile([], 'XtestVerbose.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
860 mkspell! XtestVerbose-utf8.spl XtestVerbose
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
861 set spell
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
862
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
863 " First time: the spl file should be read.
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
864 let a = execute('3verbose set spelllang=XtestVerbose-utf8.spl')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
865 call assert_match('Reading spell file "XtestVerbose-utf8.spl"', a)
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
866
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
867 " Second time time: the spl file should not be read (already read).
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
868 let a = execute('3verbose set spelllang=XtestVerbose-utf8.spl')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
869 call assert_notmatch('Reading spell file "XtestVerbose-utf8.spl"', a)
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
870
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
871 set spell& spelllang&
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
872 call delete('XtestVerbose.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
873 call delete('XtestVerbose.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
874 call delete('XtestVerbose-utf8.spl')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
875 endfunc
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
876
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
877 " Test NOBREAK (see :help spell-NOBREAK)
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
878 func Test_NOBREAK()
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
879 call writefile(['3', 'one', 'two', 'three' ], 'XtestNOBREAK.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
880 call writefile(['NOBREAK' ], 'XtestNOBREAK.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
881
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
882 mkspell! XtestNOBREAK-utf8.spl XtestNOBREAK
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
883 set spell spelllang=XtestNOBREAK-utf8.spl
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
884
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
885 call assert_equal(['', ''], spellbadword('One two three onetwo onetwothree threetwoone'))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
886
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
887 call assert_equal(['x', 'bad'], spellbadword('x'))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
888 call assert_equal(['y', 'bad'], spellbadword('yone'))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
889 call assert_equal(['z', 'bad'], spellbadword('onez'))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
890 call assert_equal(['zero', 'bad'], spellbadword('Onetwozerothree'))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
891
24758
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
892 new
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
893 call setline(1, 'Onetwwothree')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
894 norm! fw1z=
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
895 call assert_equal('Onetwothree', getline(1))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
896 call setline(1, 'Onetwothre')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
897 norm! fh1z=
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
898 call assert_equal('Onetwothree', getline(1))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
899
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
900 bw!
24727
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
901 set spell& spelllang&
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
902 call delete('XtestNOBREAK.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
903 call delete('XtestNOBREAK.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
904 call delete('XtestNOBREAK-utf8.spl')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
905 endfunc
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
906
24715
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
907 " Test CHECKCOMPOUNDPATTERN (see :help spell-CHECKCOMPOUNDPATTERN)
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
908 func Test_spellfile_CHECKCOMPOUNDPATTERN()
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
909 call writefile(['4',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
910 \ 'one/c',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
911 \ 'two/c',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
912 \ 'three/c',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
913 \ 'four'], 'XtestCHECKCOMPOUNDPATTERN.dic')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
914 " Forbid compound words where first word ends with 'wo' and second starts with 'on'.
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
915 call writefile(['CHECKCOMPOUNDPATTERN 1',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
916 \ 'CHECKCOMPOUNDPATTERN wo on',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
917 \ 'COMPOUNDFLAG c'], 'XtestCHECKCOMPOUNDPATTERN.aff')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
918
24727
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
919 mkspell! XtestCHECKCOMPOUNDPATTERN-utf8.spl XtestCHECKCOMPOUNDPATTERN
24715
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
920 set spell spelllang=XtestCHECKCOMPOUNDPATTERN-utf8.spl
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
921
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
922 " Check valid words with and without valid compounds.
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
923 for goodword in ['one', 'two', 'three', 'four',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
924 \ 'oneone', 'onetwo', 'onethree',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
925 \ 'twotwo', 'twothree',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
926 \ 'threeone', 'threetwo', 'threethree',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
927 \ 'onetwothree', 'onethreetwo', 'twothreeone', 'oneoneone']
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
928 call assert_equal(['', ''], spellbadword(goodword), goodword)
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
929 endfor
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
930
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
931 " Compounds 'twoone' or 'threetwoone' should be forbidden by CHECKCOMPOUNPATTERN.
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
932 " 'four' does not have the 'c' flag in *.aff file so no compound.
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
933 " 'five' is not in the *.dic file.
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
934 for badword in ['five', 'onetwox',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
935 \ 'twoone', 'threetwoone',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
936 \ 'fourone', 'onefour']
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
937 call assert_equal([badword, 'bad'], spellbadword(badword))
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
938 endfor
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
939
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
940 set spell& spelllang&
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
941 call delete('XtestCHECKCOMPOUNDPATTERN.dic')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
942 call delete('XtestCHECKCOMPOUNDPATTERN.aff')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
943 call delete('XtestCHECKCOMPOUNDPATTERN-utf8.spl')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
944 endfunc
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
945
25352
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
946 " Test NOCOMPOUNDSUGS (see :help spell-NOCOMPOUNDSUGS)
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
947 func Test_spellfile_NOCOMPOUNDSUGS()
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
948 call writefile(['3',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
949 \ 'one/c',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
950 \ 'two/c',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
951 \ 'three/c'], 'XtestNOCOMPOUNDSUGS.dic')
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
952
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
953 " pass 0 tests without NOCOMPOUNDSUGS, pass 1 tests with NOCOMPOUNDSUGS
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
954 for pass in [0, 1]
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
955 if pass == 0
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
956 call writefile(['COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
957 else
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
958 call writefile(['NOCOMPOUNDSUGS',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
959 \ 'COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
960 endif
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
961
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
962 mkspell! XtestNOCOMPOUNDSUGS-utf8.spl XtestNOCOMPOUNDSUGS
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
963 set spell spelllang=XtestNOCOMPOUNDSUGS-utf8.spl
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
964
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
965 for goodword in ['one', 'two', 'three',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
966 \ 'oneone', 'onetwo', 'onethree',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
967 \ 'twoone', 'twotwo', 'twothree',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
968 \ 'threeone', 'threetwo', 'threethree',
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
969 \ 'onetwothree', 'onethreetwo', 'twothreeone', 'oneoneone']
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
970 call assert_equal(['', ''], spellbadword(goodword), goodword)
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
971 endfor
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
972
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
973 for badword in ['four', 'onetwox', 'onexone']
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
974 call assert_equal([badword, 'bad'], spellbadword(badword))
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
975 endfor
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
976
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
977 if pass == 0
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
978 call assert_equal(['one', 'oneone'], spellsuggest('onne', 2))
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
979 call assert_equal(['onethree', 'one three'], spellsuggest('onethre', 2))
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
980 else
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
981 call assert_equal(['one', 'one one'], spellsuggest('onne', 2))
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
982 call assert_equal(['one three'], spellsuggest('onethre', 2))
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
983 endif
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
984 endfor
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
985
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
986 set spell& spelllang&
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
987 call delete('XtestNOCOMPOUNDSUGS.dic')
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
988 call delete('XtestNOCOMPOUNDSUGS.aff')
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
989 call delete('XtestNOCOMPOUNDSUGS-utf8.spl')
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
990 endfunc
202bc982008b patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested
Bram Moolenaar <Bram@vim.org>
parents: 24758
diff changeset
991
24715
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
992 " Test COMMON (better suggestions with common words, see :help spell-COMMON)
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
993 func Test_spellfile_COMMON()
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
994 call writefile(['7',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
995 \ 'and',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
996 \ 'ant',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
997 \ 'end',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
998 \ 'any',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
999 \ 'tee',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1000 \ 'the',
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1001 \ 'ted'], 'XtestCOMMON.dic')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1002 call writefile(['COMMON the and'], 'XtestCOMMON.aff')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1003
24727
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1004 mkspell! XtestCOMMON-utf8.spl XtestCOMMON
24715
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1005 set spell spelllang=XtestCOMMON-utf8.spl
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1006
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1007 " COMMON words 'and' and 'the' should be the top suggestions.
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1008 call assert_equal(['and', 'ant'], spellsuggest('anr', 2))
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1009 call assert_equal(['and', 'end'], spellsuggest('ond', 2))
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1010 call assert_equal(['the', 'ted'], spellsuggest('tha', 2))
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1011 call assert_equal(['the', 'tee'], spellsuggest('dhe', 2))
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1012
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1013 set spell& spelllang&
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1014 call delete('XtestCOMMON.dic')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1015 call delete('XtestCOMMON.aff')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1016 call delete('XtestCOMMON-utf8.spl')
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1017 endfunc
004b1c60daa9 patch 8.2.2896: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
1018
25617
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1019 " Test NOSUGGEST (see :help spell-COMMON)
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1020 func Test_spellfile_NOSUGGEST()
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1021 call writefile(['2', 'foo/X', 'fog'], 'XtestNOSUGGEST.dic')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1022 call writefile(['NOSUGGEST X'], 'XtestNOSUGGEST.aff')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1023
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1024 mkspell! XtestNOSUGGEST-utf8.spl XtestNOSUGGEST
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1025 set spell spelllang=XtestNOSUGGEST-utf8.spl
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1026
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1027 for goodword in ['foo', 'Foo', 'FOO', 'fog', 'Fog', 'FOG']
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1028 call assert_equal(['', ''], spellbadword(goodword), goodword)
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1029 endfor
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1030 for badword in ['foO', 'fOO', 'fooo', 'foog', 'foofog', 'fogfoo']
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1031 call assert_equal([badword, 'bad'], spellbadword(badword))
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1032 endfor
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1033
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1034 call assert_equal(['fog'], spellsuggest('fooo', 1))
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1035 call assert_equal(['fog'], spellsuggest('fOo', 1))
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1036 call assert_equal(['fog'], spellsuggest('foG', 1))
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1037 call assert_equal(['fog'], spellsuggest('fogg', 1))
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1038
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1039 set spell& spelllang&
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1040 call delete('XtestNOSUGGEST.dic')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1041 call delete('XtestNOSUGGEST.aff')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1042 call delete('XtestNOSUGGEST-utf8.spl')
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1043 endfunc
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1044
28f1b7c38ba1 patch 8.2.3345: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25352
diff changeset
1045
24727
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1046 " Test CIRCUMFIX (see: :help spell-CIRCUMFIX)
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1047 func Test_spellfile_CIRCUMFIX()
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1048 " Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1049 call writefile(['1',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1050 \ 'nagy/C po:adj'], 'XtestCIRCUMFIX.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1051 call writefile(['# circumfixes: ~ obligate prefix/suffix combinations',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1052 \ '# superlative in Hungarian: leg- (prefix) AND -bb (suffix)',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1053 \ '',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1054 \ 'CIRCUMFIX X',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1055 \ '',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1056 \ 'PFX A Y 1',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1057 \ 'PFX A 0 leg/X .',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1058 \ '',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1059 \ 'PFX B Y 1',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1060 \ 'PFX B 0 legesleg/X .',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1061 \ '',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1062 \ 'SFX C Y 3',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1063 \ 'SFX C 0 obb . is:COMPARATIVE',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1064 \ 'SFX C 0 obb/AX . is:SUPERLATIVE',
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1065 \ 'SFX C 0 obb/BX . is:SUPERSUPERLATIVE'], 'XtestCIRCUMFIX.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1066
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1067 mkspell! XtestCIRCUMFIX-utf8.spl XtestCIRCUMFIX
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1068 set spell spelllang=XtestCIRCUMFIX-utf8.spl
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1069
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1070 " From https://catalog.ldc.upenn.edu/docs/LDC2008T01/acta04.pdf:
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1071 " Hungarian English
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1072 " --------- -------
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1073 " nagy great
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1074 " nagyobb greater
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1075 " legnagyobb greatest
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1076 " legeslegnagyob most greatest
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1077 call assert_equal(['', ''], spellbadword('nagy nagyobb legnagyobb legeslegnagyobb'))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1078
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1079 for badword in ['legnagy', 'legeslegnagy', 'legobb', 'legeslegobb']
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1080 call assert_equal([badword, 'bad'], spellbadword(badword))
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1081 endfor
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1082
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1083 set spell& spelllang&
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1084 call delete('XtestCIRCUMFIX.dic')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1085 call delete('XtestCIRCUMFIX.aff')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1086 call delete('XtestCIRCUMFIX-utf8.spl')
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1087 endfunc
71ace849e9f1 patch 8.2.2902: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24715
diff changeset
1088
24758
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1089 " Test SFX that strips/chops characters
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1090 func Test_spellfile_SFX_strip()
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1091 " Simplified conjugation of Italian verbs ending in -are (first conjugation).
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1092 call writefile(['SFX A Y 4',
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1093 \ 'SFX A are iamo [^icg]are',
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1094 \ 'SFX A are hiamo [cg]are',
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1095 \ 'SFX A re mo iare',
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1096 \ 'SFX A re vamo are'],
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1097 \ 'XtestSFX.aff')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1098 " Examples of Italian verbs:
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1099 " - cantare = to sing
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1100 " - cercare = to search
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1101 " - odiare = to hate
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1102 call writefile(['3', 'cantare/A', 'cercare/A', 'odiare/A'], 'XtestSFX.dic')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1103
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1104 mkspell! XtestSFX-utf8.spl XtestSFX
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1105 set spell spelllang=XtestSFX-utf8.spl
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1106
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1107 " To sing, we're singing, we were singing.
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1108 call assert_equal(['', ''], spellbadword('cantare cantiamo cantavamo'))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1109
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1110 " To search, we're searching, we were searching.
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1111 call assert_equal(['', ''], spellbadword('cercare cerchiamo cercavamo'))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1112
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1113 " To hate, we hate, we were hating.
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1114 call assert_equal(['', ''], spellbadword('odiare odiamo odiavamo'))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1115
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1116 for badword in ['canthiamo', 'cerciamo', 'cantarevamo', 'odiiamo']
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1117 call assert_equal([badword, 'bad'], spellbadword(badword))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1118 endfor
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1119
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1120 call assert_equal(['cantiamo'], spellsuggest('canthiamo', 1))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1121 call assert_equal(['cerchiamo'], spellsuggest('cerciamo', 1))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1122 call assert_equal(['cantavamo'], spellsuggest('cantarevamo', 1))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1123 call assert_equal(['odiamo'], spellsuggest('odiiamo', 1))
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1124
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1125 set spell& spelllang&
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1126 call delete('XtestSFX.dic')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1127 call delete('XtestSFX.aff')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1128 call delete('XtestSFX-utf8.spl')
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1129 endfunc
857881ec1cb5 patch 8.2.2917: spellfile functionality not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 24727
diff changeset
1130
21945
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1131 " When 'spellfile' is not set, adding a new good word will automatically set
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1132 " the 'spellfile'
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1133 func Test_init_spellfile()
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1134 let save_rtp = &rtp
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1135 let save_encoding = &encoding
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1136 call mkdir('Xrtp/spell', 'p')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1137 call writefile(['vim'], 'Xrtp/spell/Xtest.dic')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1138 silent mkspell Xrtp/spell/Xtest.utf-8.spl Xrtp/spell/Xtest.dic
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1139 set runtimepath=./Xrtp
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1140 set spelllang=Xtest
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1141 set spell
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1142 silent spellgood abc
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1143 call assert_equal('./Xrtp/spell/Xtest.utf-8.add', &spellfile)
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1144 call assert_equal(['abc'], readfile('Xrtp/spell/Xtest.utf-8.add'))
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1145 call assert_true(filereadable('Xrtp/spell/Xtest.utf-8.spl'))
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1146 set spell& spelllang& spellfile&
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1147 call delete('Xrtp', 'rf')
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1148 let &encoding = save_encoding
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1149 let &rtp = save_rtp
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1150 %bw!
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1151 endfunc
9998f4e44a73 patch 8.2.1522: not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21887
diff changeset
1152
21947
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1153 " Test for the 'mkspellmem' option
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1154 func Test_mkspellmem_opt()
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1155 call assert_fails('set mkspellmem=1000', 'E474:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1156 call assert_fails('set mkspellmem=1000,', 'E474:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1157 call assert_fails('set mkspellmem=1000,50', 'E474:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1158 call assert_fails('set mkspellmem=1000,50,', 'E474:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1159 call assert_fails('set mkspellmem=1000,50,10,', 'E474:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1160 call assert_fails('set mkspellmem=1000,50,0', 'E474:')
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1161 endfunc
12952b240ec8 patch 8.2.1523: still not enough test coverage for the spell file handling
Bram Moolenaar <Bram@vim.org>
parents: 21945
diff changeset
1162
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
1163 " vim: shiftwidth=2 sts=2 expandtab