functionaltest: Create lua helper for os.tmpname()

In Windows Lua's os.tmpname() returns relative paths starting with \s,
prepend them with $TEMP to generate a valid path.

In OS X os.tmpname() returns paths in '/tmp' but they should be in
'/private/tmp'. We cannot use os_name() for platform detection because
some tests use tempname() before nvim is spawned, instead use one of the
following:

1. Set SYSTEM_NAME environment variable before calling the tests, it
   is set from CMAKE_SYSTEM_NAME(i.e. uname -s or 'Windows')
2. Call uname -s
3. Assume windows
This commit is contained in:
Rui Abreu Ferreira
2015-12-29 19:18:16 +00:00
parent 39c628d031
commit 9ce81f7b2b
9 changed files with 63 additions and 24 deletions

View File

@@ -13,7 +13,7 @@ describe('vim_* functions', function()
describe('command', function()
it('works', function()
local fname = os.tmpname()
local fname = helpers.tmpname()
nvim('command', 'new')
nvim('command', 'edit '..fname)
nvim('command', 'normal itesting\napi')