" Test for insert completion
source screendump.vim
source check.vim
source vim9.vim
" Test for insert expansion
func Test_ins_complete()
edit test_ins_complete.vim
" The files in the current directory interferes with the files
" used by this test. So use a separate directory for the test.
call mkdir('Xdir')
cd Xdir
set ff=unix
call writefile(["test11\t36Gepeto\t/Tag/",
\ "asd\ttest11file\t36G",
\ "Makefile\tto\trun"], 'Xtestfile')
call writefile(['', 'start of testfile',
\ 'ru',
\ 'run1',
\ 'run2',
\ 'STARTTEST',
\ 'ENDTEST',
\ 'end of testfile'], 'Xtestdata')
set ff&
enew!
edit Xtestdata
new
call append(0, ['#include "Xtestfile"', ''])
call cursor(2, 1)
set cot=
set cpt=.,w
" add-expands (word from next line) from other window
exe "normal iru\<C-N>\<C-N>\<C-X>\<C-N>\<Esc>\<C-A>"
call assert_equal('run1 run3', getline('.'))
" add-expands (current buffer first)
exe "normal o\<C-P>\<C-X>\<C-N>"
call assert_equal('run3 run3', getline('.'))
" Local expansion, ends in an empty line (unless it becomes a global
" expansion)
exe "normal o\<C-X>\<C-P>\<C-P>\<C-P>\<C-P>\<C-P>"
call assert_equal('', getline('.'))
" starts Local and switches to global add-expansion
exe "normal o\<C-X>\<C-P>\<C-P>\<C-X>\<C-X>