aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-04 18:37:27 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-04 18:37:36 +0800
commitd9c63507f89c616df21d6f840fedce3431c53f16 (patch)
tree818299e38d733ba60355ea088199ec7f518b608a /src
parent436747752bf1016d93101de24e39e192a0b721b4 (diff)
downloadrneovim-d9c63507f89c616df21d6f840fedce3431c53f16.tar.gz
rneovim-d9c63507f89c616df21d6f840fedce3431c53f16.tar.bz2
rneovim-d9c63507f89c616df21d6f840fedce3431c53f16.zip
vim-patch:8.2.1808: no test coverage for ":spelldump!"
Problem: No test coverage for ":spelldump!". Solution: Add a test. (Dominique Pellé, closes vim/vim#7089) https://github.com/vim/vim/commit/f12f0022e6698831681f0931a4e7e5298f6ef0d8
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_spell.vim38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_spell.vim b/src/nvim/testdir/test_spell.vim
index b768dc1814..61e000c8da 100644
--- a/src/nvim/testdir/test_spell.vim
+++ b/src/nvim/testdir/test_spell.vim
@@ -155,6 +155,44 @@ func Test_spell_file_missing()
%bwipe!
endfunc
+func Test_spelldump()
+ set spell spelllang=en
+ spellrare! emacs
+
+ spelldump
+
+ " Check assumption about region: 1: us, 2: au, 3: ca, 4: gb, 5: nz.
+ call assert_equal('/regions=usaucagbnz', getline(1))
+ call assert_notequal(0, search('^theater/1$')) " US English only.
+ call assert_notequal(0, search('^theatre/2345$')) " AU, CA, GB or NZ English.
+
+ call assert_notequal(0, search('^emacs/?$')) " ? for a rare word.
+ call assert_notequal(0, search('^the the/!$')) " ! for a wrong word.
+
+ bwipe
+ set spell&
+endfunc
+
+func Test_spelldump_bang()
+ new
+ call setline(1, 'This is a sample sentence.')
+ redraw
+ set spell
+ redraw
+ spelldump!
+
+ " :spelldump! includes the number of times a word was found while updating
+ " the screen.
+ " Common word count starts at 10, regular word count starts at 0.
+ call assert_notequal(0, search("^is\t11$")) " common word found once.
+ call assert_notequal(0, search("^the\t10$")) " common word never found.
+ call assert_notequal(0, search("^sample\t1$")) " regular word found once.
+ call assert_equal(0, search("^screen\t")) " regular word never found.
+
+ %bwipe!
+ set spell&
+endfunc
+
func Test_spelllang_inv_region()
set spell spelllang=en_xx
let messages = GetMessages()