legacy tests: implement :source helper method.

This commit is contained in:
Rainer Borene 2014-11-11 07:12:19 -02:00 committed by Thiago de Arruda
parent 1732615290
commit e0332e7f7c

View File

@ -182,6 +182,16 @@ local function execute(...)
end end
end end
local function source(code)
local tmpname = os.tmpname()
local tmpfile = io.open(tmpname, "w")
tmpfile:write(code)
tmpfile:flush()
tmpfile:close()
nvim_command('source '..tmpname)
os.remove(tmpname)
end
local function eq(expected, actual) local function eq(expected, actual)
return assert.are.same(expected, actual) return assert.are.same(expected, actual)
end end
@ -247,6 +257,7 @@ clear()
return { return {
clear = clear, clear = clear,
dedent = dedent, dedent = dedent,
source = source,
rawfeed = rawfeed, rawfeed = rawfeed,
insert = insert, insert = insert,
feed = feed, feed = feed,