test: use temp file #31907

This commit is contained in:
Guilherme Soares 2025-01-13 09:41:49 +00:00 committed by GitHub
parent 2c16c84998
commit a3ef29d570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -802,9 +802,10 @@ t2]])
end)
it('can detect a new parser and refresh folds accordingly', function()
write_file('test_fold_file.txt', test_text)
local name = t.tmpname()
write_file(name, test_text)
command('edit ' .. name)
command [[
e test_fold_file.txt
set filetype=some_filetype_without_treesitter_parser
set foldmethod=expr foldexpr=v:lua.vim.treesitter.foldexpr() foldcolumn=1 foldlevel=0
]]
@ -818,7 +819,7 @@ t2]])
-- reload buffer as c filetype to simulate new parser being found
feed('GA// vim: ft=c<Esc>')
command([[w | e]])
command([[write | edit]])
eq({
[1] = '>1',