Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
patch 8.1.0200: spellbadword() not tested
Problem:    spellbadword() not tested.
Solution:   Add a test. (Dominique Pelle, closes #3235)
  • Loading branch information
brammool committed Jul 20, 2018
1 parent 66ab916 commit 872e451
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/testdir/test_spell.vim
Expand Up @@ -68,6 +68,47 @@ func Test_z_equal_on_invalid_utf8_word()
bwipe!
endfunc

" Test spellbadword() with argument
func Test_spellbadword()
set spell

call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))

set spelllang=en
call assert_equal(['', ''], spellbadword('centre'))
call assert_equal(['', ''], spellbadword('center'))
set spelllang=en_us
call assert_equal(['centre', 'local'], spellbadword('centre'))
call assert_equal(['', ''], spellbadword('center'))
set spelllang=en_gb
call assert_equal(['', ''], spellbadword('centre'))
call assert_equal(['center', 'local'], spellbadword('center'))

" Create a small word list to test that spellbadword('...')
" can return ['...', 'rare'].
e Xwords
insert
foo
foobar/?
.
w!
mkspell! Xwords.spl Xwords
set spelllang=Xwords.spl
call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))

" Typo should not be detected without the 'spell' option.
set spelllang=en_gb nospell
call assert_equal(['', ''], spellbadword('centre'))
call assert_equal(['', ''], spellbadword('My bycycle.'))
call assert_equal(['', ''], spellbadword('A sentence. another sentence'))

call delete('Xwords.spl')
call delete('Xwords')
set spelllang&
set spell&
endfunc

func Test_spellreall()
new
set spell
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -789,6 +789,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
200,
/**/
199,
/**/
Expand Down

0 comments on commit 872e451

Please sign in to comment.