diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-03-06 09:25:58 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-03-07 06:43:03 +0800 |
commit | 0442635a509b242794d43605b74090242e645096 (patch) | |
tree | 148f198fff4171baa3073f8a17bdf52aa471551d | |
parent | eb70540ff0385f3929b39f26faceaa2765f6949a (diff) | |
download | rneovim-0442635a509b242794d43605b74090242e645096.tar.gz rneovim-0442635a509b242794d43605b74090242e645096.tar.bz2 rneovim-0442635a509b242794d43605b74090242e645096.zip |
test(autochdir_spec): use better patterns
-rw-r--r-- | test/functional/legacy/autochdir_spec.lua | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua index 7d2fdfc26e..13cb6cd287 100644 --- a/test/functional/legacy/autochdir_spec.lua +++ b/test/functional/legacy/autochdir_spec.lua @@ -14,19 +14,20 @@ describe('autochdir behavior', function() before_each(function() lfs.mkdir(dir) clear() + command('set shellslash') end) after_each(function() helpers.rmdir(dir) end) - -- Tests vim/vim/777 without test_autochdir(). + -- Tests vim/vim#777 without test_autochdir(). it('sets filename', function() command('set acd') command('new') command('w '..dir..'/Xtest') eq('Xtest', eval("expand('%')")) - eq(dir, eval([[substitute(getcwd(), '.*[/\\]\(\k*\)', '\1', '')]])) + eq(dir, eval([[substitute(getcwd(), '.*/\(\k*\)', '\1', '')]])) end) it(':file in win_execute() does not cause wrong directory', function() @@ -68,11 +69,11 @@ describe('autochdir behavior', function() call('mkdir', subdir) local winid = eval('win_getid()') command('new '..subdir..'/file') - matches('.*'..dir..'[/\\]'..subdir, eval('getcwd()')) + matches(dir..'/'..subdir..'$', eval('getcwd()')) command('cd ..') - matches('.*'..dir, eval('getcwd()')) + matches(dir..'$', eval('getcwd()')) call('win_execute', winid, 'echo') - matches('.*'..dir, eval('getcwd()')) + matches(dir..'$', eval('getcwd()')) end) it(':verbose pwd shows whether autochdir is used', function() @@ -80,36 +81,36 @@ describe('autochdir behavior', function() command('cd '..dir) local cwd = eval('getcwd()') command('edit global.txt') - matches('%[global%].*'..dir, exec_capture('verbose pwd')) + matches('%[global%].*'..dir..'$', exec_capture('verbose pwd')) call('mkdir', subdir) command('split '..subdir..'/local.txt') command('lcd '..subdir) - matches('%[window%].*'..dir..'[/\\]'..subdir, exec_capture('verbose pwd')) + matches('%[window%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd')) command('set acd') command('wincmd w') - matches('%[autochdir%].*'..dir, exec_capture('verbose pwd')) + matches('%[autochdir%].*'..dir..'$', exec_capture('verbose pwd')) command('tcd '..cwd) - matches('%[tabpage%].*'..dir, exec_capture('verbose pwd')) + matches('%[tabpage%].*'..dir..'$', exec_capture('verbose pwd')) command('cd '..cwd) - matches('%[global%].*'..dir, exec_capture('verbose pwd')) + matches('%[global%].*'..dir..'$', exec_capture('verbose pwd')) command('lcd '..cwd) - matches('%[window%].*'..dir, exec_capture('verbose pwd')) + matches('%[window%].*'..dir..'$', exec_capture('verbose pwd')) command('edit') - matches('%[autochdir%].*'..dir, exec_capture('verbose pwd')) + matches('%[autochdir%].*'..dir..'$', exec_capture('verbose pwd')) command('enew') command('wincmd w') - matches('%[autochdir%].*'..dir..'[/\\]'..subdir, exec_capture('verbose pwd')) + matches('%[autochdir%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd')) command('wincmd w') - matches('%[window%].*'..dir, exec_capture('verbose pwd')) + matches('%[window%].*'..dir..'$', exec_capture('verbose pwd')) command('wincmd w') - matches('%[autochdir%].*'..dir..'[/\\]'..subdir, exec_capture('verbose pwd')) + matches('%[autochdir%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd')) command('set noacd') - matches('%[autochdir%].*'..dir..'[/\\]'..subdir, exec_capture('verbose pwd')) + matches('%[autochdir%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd')) command('wincmd w') - matches('%[window%].*'..dir, exec_capture('verbose pwd')) + matches('%[window%].*'..dir..'$', exec_capture('verbose pwd')) command('cd '..cwd) - matches('%[global%].*'..dir, exec_capture('verbose pwd')) + matches('%[global%].*'..dir..'$', exec_capture('verbose pwd')) command('wincmd w') - matches('%[window%].*'..dir..'[/\\]'..subdir, exec_capture('verbose pwd')) + matches('%[window%].*'..dir..'/'..subdir..'$', exec_capture('verbose pwd')) end) end) |