aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/path_spec.lua
diff options
context:
space:
mode:
authorIgnas Anikevicius <anikevicius@gmail.com>2017-09-18 21:06:55 +0300
committerJustin M. Keyes <justinkz@gmail.com>2017-10-02 00:48:30 +0200
commit2b133101cf67b523c2503ef715dfb9ebfa732da2 (patch)
tree3955290491608369498a6821d070d6d711248da2 /test/functional/core/path_spec.lua
parent981387b7c83026c1446cdddf6b374f63973a2b86 (diff)
downloadrneovim-2b133101cf67b523c2503ef715dfb9ebfa732da2.tar.gz
rneovim-2b133101cf67b523c2503ef715dfb9ebfa732da2.tar.bz2
rneovim-2b133101cf67b523c2503ef715dfb9ebfa732da2.zip
win: vim_FullName(): force backslashes #7287
- Replace obvious cases of '/' literal with PATHSEP. (There are still some remaining cases that need closer inspection.) - Fixup tests: ui/screen_basic closes #7117 ref https://github.com/neovim/neovim/issues/2471#issuecomment-271193714
Diffstat (limited to 'test/functional/core/path_spec.lua')
-rw-r--r--test/functional/core/path_spec.lua61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/functional/core/path_spec.lua b/test/functional/core/path_spec.lua
new file mode 100644
index 0000000000..44e69fff7b
--- /dev/null
+++ b/test/functional/core/path_spec.lua
@@ -0,0 +1,61 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local eq = helpers.eq
+local eval = helpers.eval
+local get_pathsep = helpers.get_pathsep
+local command = helpers.command
+
+describe("'%:p' expanding", function()
+ local pathsep
+ local targetdir
+ local expected_path
+
+ local function get_full_path()
+ return eval('expand("%:p")')
+ end
+
+ local function join_path(...)
+ return table.concat({...}, pathsep)
+ end
+
+ before_each(function()
+ clear()
+ pathsep = get_pathsep()
+ targetdir = join_path('test', 'functional', 'fixtures')
+ clear(join_path(targetdir, 'tty-test.c'))
+ expected_path = get_full_path()
+ end)
+
+ it('given a relative path with current directory in the middle #7117', function()
+ clear(join_path(targetdir, '.', 'tty-test.c'))
+ eq(expected_path, get_full_path())
+ end)
+
+ it('given a relative path with current directory #7117', function()
+ clear(join_path('.', targetdir, 'tty-test.c'))
+ eq(expected_path, get_full_path())
+ end)
+
+ it('given a relative path with current directory to a file when changing directory #7117', function()
+ clear(join_path('.', targetdir, 'tty-test.c'))
+ command('cd test')
+ eq(expected_path, get_full_path())
+ end)
+
+ it('given a relative path with directory up the tree to a file #7117', function()
+ clear(join_path(targetdir, '..', 'fixtures', 'tty-test.c'))
+ eq(expected_path, get_full_path())
+ end)
+
+ it('given a different starting directory and a relative path with directory up the tree #7117', function()
+ command('cd test')
+ command('e ' .. join_path('..', targetdir, 'tty-test.c'))
+ eq(expected_path, get_full_path())
+ end)
+
+ it('given a different starting directory and a relative path with current directory and up the tree #7117', function()
+ command('cd test')
+ command('e ' .. join_path('.', '..', targetdir, 'tty-test.c'))
+ eq(expected_path, get_full_path())
+ end)
+end)