comparison src/testdir/test_spell.vim @ 14370:ceeeeb6b1fb0 v8.1.0200

patch 8.1.0200: spellbadword() not tested commit https://github.com/vim/vim/commit/872e451e8c326d5dd3062ef621fcbf0a4c5bef78 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 20 23:36:26 2018 +0200 patch 8.1.0200: spellbadword() not tested Problem: spellbadword() not tested. Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/3235)
author Christian Brabandt <cb@256bit.org>
date Fri, 20 Jul 2018 23:45:04 +0200
parents 3dd37eec73f0
children 5a384b3806ec
comparison
equal deleted inserted replaced
14369:9b568c8ad8cb 14370:ceeeeb6b1fb0
64 set spell 64 set spell
65 call setline(1, "\xff") 65 call setline(1, "\xff")
66 norm z= 66 norm z=
67 set nospell 67 set nospell
68 bwipe! 68 bwipe!
69 endfunc
70
71 " Test spellbadword() with argument
72 func Test_spellbadword()
73 set spell
74
75 call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
76 call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))
77
78 set spelllang=en
79 call assert_equal(['', ''], spellbadword('centre'))
80 call assert_equal(['', ''], spellbadword('center'))
81 set spelllang=en_us
82 call assert_equal(['centre', 'local'], spellbadword('centre'))
83 call assert_equal(['', ''], spellbadword('center'))
84 set spelllang=en_gb
85 call assert_equal(['', ''], spellbadword('centre'))
86 call assert_equal(['center', 'local'], spellbadword('center'))
87
88 " Create a small word list to test that spellbadword('...')
89 " can return ['...', 'rare'].
90 e Xwords
91 insert
92 foo
93 foobar/?
94 .
95 w!
96 mkspell! Xwords.spl Xwords
97 set spelllang=Xwords.spl
98 call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
99
100 " Typo should not be detected without the 'spell' option.
101 set spelllang=en_gb nospell
102 call assert_equal(['', ''], spellbadword('centre'))
103 call assert_equal(['', ''], spellbadword('My bycycle.'))
104 call assert_equal(['', ''], spellbadword('A sentence. another sentence'))
105
106 call delete('Xwords.spl')
107 call delete('Xwords')
108 set spelllang&
109 set spell&
69 endfunc 110 endfunc
70 111
71 func Test_spellreall() 112 func Test_spellreall()
72 new 113 new
73 set spell 114 set spell