mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test(lsp): file URIs without a hostname
This commit is contained in:
parent
a2c2a08652
commit
ce5f4228aa
@ -53,12 +53,18 @@ describe('URI methods', function()
|
|||||||
|
|
||||||
describe('uri to filepath', function()
|
describe('uri to filepath', function()
|
||||||
describe('decode Unix file path', function()
|
describe('decode Unix file path', function()
|
||||||
it('file path includes only ascii charactors', function()
|
it('file path includes only ascii characters', function()
|
||||||
exec_lua("uri = 'file:///Foo/Bar/Baz.txt'")
|
exec_lua("uri = 'file:///Foo/Bar/Baz.txt'")
|
||||||
|
|
||||||
eq('/Foo/Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)"))
|
eq('/Foo/Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('local file path without hostname', function()
|
||||||
|
exec_lua("uri = 'file:/Foo/Bar/Baz.txt'")
|
||||||
|
|
||||||
|
eq('/Foo/Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)"))
|
||||||
|
end)
|
||||||
|
|
||||||
it('file path including white space', function()
|
it('file path including white space', function()
|
||||||
exec_lua("uri = 'file:///Foo%20/Bar/Baz.txt'")
|
exec_lua("uri = 'file:///Foo%20/Bar/Baz.txt'")
|
||||||
|
|
||||||
@ -85,6 +91,15 @@ describe('URI methods', function()
|
|||||||
eq('C:\\Foo\\Bar\\Baz.txt', exec_lua(test_case))
|
eq('C:\\Foo\\Bar\\Baz.txt', exec_lua(test_case))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('local file path without hostname', function()
|
||||||
|
local test_case = [[
|
||||||
|
local uri = 'file:/C:/Foo/Bar/Baz.txt'
|
||||||
|
return vim.uri_to_fname(uri)
|
||||||
|
]]
|
||||||
|
|
||||||
|
eq('C:\\Foo\\Bar\\Baz.txt', exec_lua(test_case))
|
||||||
|
end)
|
||||||
|
|
||||||
it('file path includes only ascii charactors with encoded colon character', function()
|
it('file path includes only ascii charactors with encoded colon character', function()
|
||||||
local test_case = [[
|
local test_case = [[
|
||||||
local uri = 'file:///C%3A/Foo/Bar/Baz.txt'
|
local uri = 'file:///C%3A/Foo/Bar/Baz.txt'
|
||||||
|
Loading…
Reference in New Issue
Block a user