diff options
-rw-r--r-- | test/functional/eval/buf_functions_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/helpers.lua | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/test/functional/eval/buf_functions_spec.lua b/test/functional/eval/buf_functions_spec.lua index a130da4452..db50874c53 100644 --- a/test/functional/eval/buf_functions_spec.lua +++ b/test/functional/eval/buf_functions_spec.lua @@ -13,6 +13,7 @@ local winmeths = helpers.winmeths local curbufmeths = helpers.curbufmeths local curwinmeths = helpers.curwinmeths local curtabmeths = helpers.curtabmeths +local get_pathsep = helpers.get_pathsep local fname = 'Xtest-functional-eval-buf_functions' local fname2 = fname .. '.2' @@ -66,14 +67,15 @@ describe('bufname() function', function() eq('', funcs.bufname('%')) -- Buffer has no name yet command('file ' .. fname) local wd = lfs.currentdir() + local sep = get_pathsep() local curdirname = funcs.fnamemodify(wd, ':t') for _, arg in ipairs({'%', 1, 'X', wd}) do eq(fname, funcs.bufname(arg)) meths.set_current_dir('..') - eq(curdirname .. '/' .. fname, funcs.bufname(arg)) + eq(curdirname .. sep .. fname, funcs.bufname(arg)) meths.set_current_dir(curdirname) meths.set_current_dir(dirname) - eq(wd .. '/' .. fname, funcs.bufname(arg)) + eq(wd .. sep .. fname, funcs.bufname(arg)) meths.set_current_dir('..') eq(fname, funcs.bufname(arg)) command('enew') diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 13a0cff137..7ce95d0b7c 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -570,6 +570,10 @@ local curbufmeths = create_callindex(curbuf) local curwinmeths = create_callindex(curwin) local curtabmeths = create_callindex(curtab) +local function get_pathsep() + return funcs.fnamemodify('.', ':p'):sub(-1) +end + local M = { prepend_argv = prepend_argv, clear = clear, @@ -635,6 +639,7 @@ local M = { tmpname = tmpname, meth_pcall = meth_pcall, NIL = mpack.NIL, + get_pathsep = get_pathsep, } return function(after_each) |