summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_edit.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-01-03 11:03:48 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-03 11:03:48 +0000
commite982586f8eebf2b055987218f6d3f7a084c4bf69 (patch)
tree99e63f241c4e8f329eca27a710dfbf335c965d97 /src/testdir/test_edit.vim
parent475d9521baaeb060ebb915d678094ff28e67b5be (diff)
patch 8.2.3989: some insert completion code is not testedv8.2.3989
Problem: Some insert completion code is not tested. Solution: Add a few tests. Refactor thesaurus completion. (Yegappan Lakshmanan, closes #9460)
Diffstat (limited to 'src/testdir/test_edit.vim')
-rw-r--r--src/testdir/test_edit.vim26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index c39c8a0fb1..e83d67250c 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -733,8 +733,13 @@ func Test_edit_CTRL_N()
call feedkeys("Ii\<c-n>\<cr>\<esc>", "tnix")
call feedkeys("ILO\<c-n>\<cr>\<esc>", 'tnix')
call assert_equal(['INFER', 'loWER', 'infer', 'LOWER', '', ''], getline(1, '$'), e)
-
- set noignorecase noinfercase complete&
+ set noignorecase noinfercase
+ %d
+ call setline(1, ['one word', 'two word'])
+ exe "normal! Goo\<C-P>\<C-X>\<C-P>"
+ call assert_equal('one word', getline(3))
+ %d
+ set complete&
bw!
endfor
endfunc
@@ -900,6 +905,23 @@ func Test_edit_CTRL_T()
bw!
endfunc
+" Test thesaurus completion with different encodings
+func Test_thesaurus_complete_with_encoding()
+ call writefile(['angry furious mad enraged'], 'Xthesaurus')
+ set thesaurus=Xthesaurus
+ for e in ['latin1', 'utf-8']
+ exe 'set encoding=' .. e
+ new
+ call setline(1, 'mad')
+ call cursor(1, 1)
+ call feedkeys("A\<c-x>\<c-t>\<cr>\<esc>", 'tnix')
+ call assert_equal(['mad', ''], getline(1, '$'))
+ bw!
+ endfor
+ set thesaurus=
+ call delete('Xthesaurus')
+endfunc
+
" Test 'thesaurusfunc'
func MyThesaurus(findstart, base)
let mythesaurus = [