test(old): emulate test_override('char_avail') using FFI

Add a non-static variable for this, otherwise it'll be really hacky.
This avoid having to rewrite many incsearch tests in Lua.

(cherry picked from commit c925e7b8ba)
This commit is contained in:
zeertzjq
2025-07-03 21:23:26 +08:00
committed by github-actions[bot]
parent f0f163b267
commit d1214da08f
9 changed files with 106 additions and 107 deletions

View File

@@ -2519,10 +2519,9 @@ endfunc
" Test TextChangedI and TextChangedP
func Test_ChangedP()
throw 'Skipped: use test/functional/autocmd/textchanged_spec.lua'
new
call setline(1, ['foo', 'bar', 'foobar'])
call test_override("char_avail", 1)
call Ntest_override("char_avail", 1)
set complete=. completeopt=menuone
func! TextChangedAutocmd(char)
@@ -2563,7 +2562,7 @@ func Test_ChangedP()
" TODO: how should it handle completeopt=noinsert,noselect?
" CleanUp
call test_override("char_avail", 0)
call Ntest_override("char_avail", 0)
au! TextChanged
au! TextChangedI
au! TextChangedP
@@ -2583,9 +2582,8 @@ func SetLineOne()
endfunc
func Test_TextChangedI_with_setline()
throw 'Skipped: use test/functional/autocmd/textchanged_spec.lua'
new
call test_override('char_avail', 1)
call Ntest_override('char_avail', 1)
autocmd TextChangedI <buffer> call SetLineOne()
call feedkeys("i(\<CR>\<Esc>", 'tx')
call assert_equal('(', getline(1))
@@ -2594,7 +2592,7 @@ func Test_TextChangedI_with_setline()
call assert_equal('', getline(1))
call assert_equal('', getline(2))
call test_override('char_avail', 0)
call Ntest_override('char_avail', 0)
bwipe!
endfunc