tests: Make helper.source() return tempname.

This commit is contained in:
watiko
2015-12-30 19:14:33 +09:00
parent feed81f45f
commit 59b04d856b
2 changed files with 6 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
require('coxpcall')
local ffi = require('ffi')
local lfs = require('lfs')
local assert = require('luassert')
local Loop = require('nvim.loop')
@@ -246,9 +247,13 @@ end
local function source(code)
local tmpname = os.tmpname()
if ffi.os == 'OSX' and string.match(tmpname, '^/tmp') then
tmpname = '/private'..tmpname
end
write_file(tmpname, code)
nvim_command('source '..tmpname)
os.remove(tmpname)
return tmpname
end
local function eq(expected, actual)