tests: Fix OSX's tempname issue.

This commit is contained in:
watiko
2015-12-19 10:25:19 +09:00
parent d37dc0b314
commit feed81f45f

View File

@@ -1,3 +1,4 @@
local ffi = require('ffi')
local helpers = require('test.functional.helpers')
local nvim, call = helpers.meths, helpers.call
local clear, eq = helpers.clear, helpers.eq
@@ -13,6 +14,11 @@ 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)