aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/cd_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-05-31 22:35:02 -0400
committerJames McCoy <jamessan@jamessan.com>2016-06-01 06:48:41 -0400
commit690970acffba1cedfaad436fecb7380b458f82de (patch)
treeb86e40ed3f17d93c6be8f75d4a1a790d12fdfc7d /test/functional/ex_cmds/cd_spec.lua
parent0afe63e9253c259699c5cc714e451e0273de16ee (diff)
downloadrneovim-690970acffba1cedfaad436fecb7380b458f82de.tar.gz
rneovim-690970acffba1cedfaad436fecb7380b458f82de.tar.bz2
rneovim-690970acffba1cedfaad436fecb7380b458f82de.zip
test/functional: Allow arbitrary arguments to cwd/lwd functions
Build wcwd/tcwd and wlwd/tlwd on top of the reworked cwd/lwd functions. This will allow for easier testing of `getcwd()`/`haslocaldir()` in arbitrary windows and/or tab pages.
Diffstat (limited to 'test/functional/ex_cmds/cd_spec.lua')
-rw-r--r--test/functional/ex_cmds/cd_spec.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index 69467632a4..3f2371a3d1 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -1,9 +1,13 @@
-- Specs for :cd, :tcd, :lcd and getcwd()
-local helpers = require('test.functional.helpers')
-local execute, eq, clear, eval, exc_exec =
- helpers.execute, helpers.eq, helpers.clear, helpers.eval, helpers.exc_exec
local lfs = require('lfs')
+local helpers = require('test.functional.helpers')
+
+local eq = helpers.eq
+local call = helpers.call
+local clear = helpers.clear
+local execute = helpers.execute
+local exc_exec = helpers.exc_exec
-- These directories will be created for testing
local directories = {
@@ -13,15 +17,14 @@ local directories = {
}
-- Shorthand writing to get the current working directory
-local cwd = function() return eval('getcwd( )') end -- effective working dir
-local wcwd = function() return eval('getcwd( 0 )') end -- window dir
-local tcwd = function() return eval('getcwd(-1, 0)') end -- tab dir
---local gcwd = function() return eval('getcwd(-1, -1)') end -- global dir
+local cwd = function(...) return call('getcwd', ...) end -- effective working dir
+local wcwd = function() return cwd(0) end -- window dir
+local tcwd = function() return cwd(-1, 0) end -- tab dir
-- Same, except these tell us if there is a working directory at all
---local lwd = function() return eval('haslocaldir( )') end -- effective working dir
-local wlwd = function() return eval('haslocaldir( 0 )') end -- window dir
-local tlwd = function() return eval('haslocaldir(-1, 0)') end -- tab dir
+local lwd = function(...) return call('haslocaldir', ...) end -- effective working dir
+local wlwd = function() return lwd(0) end -- window dir
+local tlwd = function() return lwd(-1, 0) end -- tab dir
--local glwd = function() return eval('haslocaldir(-1, -1)') end -- global dir
-- Test both the `cd` and `chdir` variants