feat(test): use nvim_exec in helpers.source() #16064

helpers.source() was a hack to work around the lack of anonymous
:source. Its "create tempfile" behavior is not a required part of most
tests that use it.

Some tests still need the old "create tempfile" behavior either because
they test SID behavior, or because of missing nvim_exec features: #16071
This commit is contained in:
Justin M. Keyes
2022-03-27 10:25:55 -07:00
committed by GitHub
parent 05edab85d7
commit 72652cbc46
13 changed files with 93 additions and 70 deletions

View File

@@ -136,19 +136,19 @@ describe('assert function:', function()
end)
it('should have file names and passed messages', function()
local tmpname_one = source([[
source([[
call assert_equal(1, 100, 'equal assertion failed')
call assert_false('true', 'true assertion failed')
call assert_true('false', 'false assertion failed')
]])
local tmpname_two = source([[
source([[
call assert_true('', 'file two')
]])
expected_errors({
tmpname_one .. " line 1: equal assertion failed: Expected 1 but got 100",
tmpname_one .. " line 2: true assertion failed: Expected False but got 'true'",
tmpname_one .. " line 3: false assertion failed: Expected True but got 'false'",
tmpname_two .. " line 1: file two: Expected True but got ''",
"nvim_exec(): equal assertion failed: Expected 1 but got 100",
"nvim_exec(): true assertion failed: Expected False but got 'true'",
"nvim_exec(): false assertion failed: Expected True but got 'false'",
"nvim_exec(): file two: Expected True but got ''",
})
end)
end)