mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
5eb5f49488
Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
71 lines
2.1 KiB
Lua
71 lines
2.1 KiB
Lua
local helpers = require('test.functional.helpers')(after_each)
|
||
local clear = helpers.clear
|
||
local eq = helpers.eq
|
||
local eval = helpers.eval
|
||
local command = helpers.command
|
||
local insert = helpers.insert
|
||
local feed = helpers.feed
|
||
local is_os = helpers.is_os
|
||
|
||
describe('path collapse', function()
|
||
local targetdir
|
||
local expected_path
|
||
|
||
local function join_path(...)
|
||
local pathsep = (is_os('win') and '\\' or '/')
|
||
return table.concat({...}, pathsep)
|
||
end
|
||
|
||
before_each(function()
|
||
targetdir = join_path('test', 'functional', 'fixtures')
|
||
clear()
|
||
command('edit '..join_path(targetdir, 'tty-test.c'))
|
||
expected_path = eval('expand("%:p")')
|
||
end)
|
||
|
||
it('with /./ segment #7117', function()
|
||
command('edit '..join_path(targetdir, '.', 'tty-test.c'))
|
||
eq(expected_path, eval('expand("%:p")'))
|
||
end)
|
||
|
||
it('with ./ prefix #7117', function()
|
||
command('edit '..join_path('.', targetdir, 'tty-test.c'))
|
||
eq(expected_path, eval('expand("%:p")'))
|
||
end)
|
||
|
||
it('with ./ prefix, after directory change #7117', function()
|
||
command('edit '..join_path('.', targetdir, 'tty-test.c'))
|
||
command('cd test')
|
||
eq(expected_path, eval('expand("%:p")'))
|
||
end)
|
||
|
||
it('with /../ segment #7117', function()
|
||
command('edit '..join_path(targetdir, '..', 'fixtures', 'tty-test.c'))
|
||
eq(expected_path, eval('expand("%:p")'))
|
||
end)
|
||
|
||
it('with ../ and different starting directory #7117', function()
|
||
command('cd test')
|
||
command('edit '..join_path('..', targetdir, 'tty-test.c'))
|
||
eq(expected_path, eval('expand("%:p")'))
|
||
end)
|
||
|
||
it('with ./../ and different starting directory #7117', function()
|
||
command('cd test')
|
||
command('edit '..join_path('.', '..', targetdir, 'tty-test.c'))
|
||
eq(expected_path, eval('expand("%:p")'))
|
||
end)
|
||
end)
|
||
|
||
describe('file search', function()
|
||
before_each(clear)
|
||
|
||
it('find multibyte file name in line #20517', function()
|
||
command('cd test/functional/fixtures')
|
||
insert('filename_with_unicode_ααα')
|
||
eq('', eval('expand("%")'))
|
||
feed('gf')
|
||
eq('filename_with_unicode_ααα', eval('expand("%:t")'))
|
||
end)
|
||
end)
|