Bram Moolenaar | d3f78dc | 2017-02-25 14:21:10 +0100 | [diff] [blame] | 1 | " Test spell checking |
| 2 | " TODO: move test58 tests here |
| 3 | |
| 4 | if !has('spell') |
| 5 | finish |
| 6 | endif |
| 7 | |
| 8 | func Test_wrap_search() |
| 9 | new |
| 10 | call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End']) |
| 11 | set spell wrapscan |
| 12 | normal ]s |
| 13 | call assert_equal('plong', expand('<cword>')) |
| 14 | normal ]s |
| 15 | call assert_equal('zpelling', expand('<cword>')) |
| 16 | normal ]s |
| 17 | call assert_equal('plong', expand('<cword>')) |
| 18 | bwipe! |
| 19 | set nospell |
| 20 | endfunc |
Bram Moolenaar | 5b276aa | 2017-04-22 23:49:52 +0200 | [diff] [blame] | 21 | |
| 22 | func Test_z_equal_on_invalid_utf8_word() |
| 23 | split |
| 24 | set spell |
| 25 | call setline(1, "\xff") |
| 26 | norm z= |
| 27 | set nospell |
| 28 | bwipe! |
| 29 | endfunc |
Bram Moolenaar | 545cb79 | 2017-05-23 11:31:22 +0200 | [diff] [blame] | 30 | |
| 31 | func Test_spellreall() |
| 32 | new |
| 33 | set spell |
| 34 | call assert_fails('spellrepall', 'E752:') |
| 35 | call setline(1, ['A speling mistake. The same speling mistake.', |
| 36 | \ 'Another speling mistake.']) |
| 37 | call feedkeys(']s1z=', 'tx') |
| 38 | call assert_equal('A spelling mistake. The same speling mistake.', getline(1)) |
| 39 | call assert_equal('Another speling mistake.', getline(2)) |
| 40 | spellrepall |
| 41 | call assert_equal('A spelling mistake. The same spelling mistake.', getline(1)) |
| 42 | call assert_equal('Another spelling mistake.', getline(2)) |
| 43 | call assert_fails('spellrepall', 'E753:') |
| 44 | set spell& |
| 45 | bwipe! |
| 46 | endfunc |