summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-01 14:46:20 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-01 14:46:20 +0200
commit8eb7523802cb51984e2202d08a4fbc1a2cd803c7 (patch)
treee72fb74d077c570a1d2074bfb442c80b39c6ca9a /src/testdir
parentcbb92b5ceb6a8169b6eddceec3837aac02f21e3b (diff)
patch 9.1.0251: Filetype test failsv9.1.0251
Problem: Filetype test fails. Solution: Move detection by name before detection by extension. Improve TextChanged test and remove wrong test and fix a typo in a comment (zeertzjq). closes: #14373 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_autocmd.vim21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index e69a3f60e7..7d0adf9c2c 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -3734,11 +3734,6 @@ func Test_Changed_ChangedI()
call feedkeys("yypi\<esc>", 'tnix')
call assert_equal('', g:autocmd_i)
- " TextChanged should only trigger if change was done in Normal mode
- let g:autocmd_n = ''
- call feedkeys("ibar\<esc>", 'tnix')
- call assert_equal('', g:autocmd_n)
-
" If change is a mix of Normal and Insert modes, TextChangedI should trigger
func s:validate_mixed_textchangedi(keys)
call feedkeys("ifoo\<esc>", 'tnix')
@@ -4532,20 +4527,30 @@ endfunc
" Test TextChangedI and TextChanged
func Test_Changed_ChangedI_2()
+ " Run this test in a terminal because it requires running the main loop.
CheckRunVimInTerminal
call writefile(['one', 'two', 'three'], 'XTextChangedI2', 'D')
let before =<< trim END
- autocmd TextChanged,TextChangedI * call writefile([b:changedtick], 'XTextChangedI3')
+ let [g:autocmd_n, g:autocmd_i] = ['','']
+
+ func TextChangedAutocmd(char)
+ let g:autocmd_{tolower(a:char)} = a:char .. b:changedtick
+ call writefile([g:autocmd_n, g:autocmd_i], 'XTextChangedI3')
+ endfunc
+
+ au TextChanged <buffer> :call TextChangedAutocmd('N')
+ au TextChangedI <buffer> :call TextChangedAutocmd('I')
+
nnoremap <CR> o<Esc>
call writefile([], 'XTextChangedI3')
END
call writefile(before, 'Xinit', 'D')
let buf = RunVimInTerminal('-S Xinit XtextChangedI2', {})
+ call WaitForAssert({-> assert_true(filereadable('XTextChangedI3'))})
call term_sendkeys(buf, "\<cr>")
- call term_wait(buf)
+ call WaitForAssert({-> assert_equal(['N4', ''], readfile('XTextChangedI3'))})
call StopVimInTerminal(buf)
- call assert_equal(['4'], readfile('XTextChangedI3'))
call delete('XTextChangedI3')
endfunc