aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Pezzoni <alessandro.pezzoni@runbox.com>2021-07-07 23:39:27 +0100
committerAlessandro Pezzoni <alessandro.pezzoni@runbox.com>2021-07-10 18:27:37 +0100
commitce5f4228aae8bdf154265e3be2da1f56c6f80350 (patch)
tree75f461f7e5657aedce1612c79e396fcea09ef341
parenta2c2a086528d74bb0f6b2b68745b015f22ddd68a (diff)
downloadrneovim-ce5f4228aae8bdf154265e3be2da1f56c6f80350.tar.gz
rneovim-ce5f4228aae8bdf154265e3be2da1f56c6f80350.tar.bz2
rneovim-ce5f4228aae8bdf154265e3be2da1f56c6f80350.zip
test(lsp): file URIs without a hostname
-rw-r--r--test/functional/lua/uri_spec.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua
index f782769935..7d7dae7ed3 100644
--- a/test/functional/lua/uri_spec.lua
+++ b/test/functional/lua/uri_spec.lua
@@ -53,12 +53,18 @@ describe('URI methods', function()
describe('uri to filepath', 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'")
eq('/Foo/Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)"))
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()
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))
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()
local test_case = [[
local uri = 'file:///C%3A/Foo/Bar/Baz.txt'