aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-03-24 19:44:06 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-08-08 21:31:20 -0400
commitd1ce15f696b719bef12c1e38875c6016c60aafac (patch)
tree5db3ff974c1ff9ddcb1c3e3098a74de31d0eabef /src
parent18888c15fc456040f860cfe55e1bf6be3dfd1dbe (diff)
downloadrneovim-d1ce15f696b719bef12c1e38875c6016c60aafac.tar.gz
rneovim-d1ce15f696b719bef12c1e38875c6016c60aafac.tar.bz2
rneovim-d1ce15f696b719bef12c1e38875c6016c60aafac.zip
vim-patch:8.1.0200: spellbadword() not tested
Problem: spellbadword() not tested. Solution: Add a test. (Dominique Pelle, closes vim/vim#3235) https://github.com/vim/vim/commit/872e451e8c326d5dd3062ef621fcbf0a4c5bef78
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_spell.vim41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim
index d7b8ca9e9c..230cb72335 100644
--- a/src/nvim/testdir/test_spell.vim
+++ b/src/nvim/testdir/test_spell.vim
@@ -69,6 +69,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