From ce5f4228aae8bdf154265e3be2da1f56c6f80350 Mon Sep 17 00:00:00 2001 From: Alessandro Pezzoni Date: Wed, 7 Jul 2021 23:39:27 +0100 Subject: test(lsp): file URIs without a hostname --- test/functional/lua/uri_spec.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'test/functional/lua/uri_spec.lua') 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' -- cgit