diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2020-05-21 18:17:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-22 01:17:21 +0900 |
commit | 04a0486c66e2ae6d67cad990f95283863dbe28fd (patch) | |
tree | c65d01889914915238c5848ffaaa19c5841a0e23 /test/functional/lua/uri_spec.lua | |
parent | 044eb56ed2f44b545e7488990ecf195a930174aa (diff) | |
download | rneovim-04a0486c66e2ae6d67cad990f95283863dbe28fd.tar.gz rneovim-04a0486c66e2ae6d67cad990f95283863dbe28fd.tar.bz2 rneovim-04a0486c66e2ae6d67cad990f95283863dbe28fd.zip |
Change uri_to_fname to not convert non-file URIs (#12351)
* Change uri_to_fname to not convert non-file URIs
A URI with a scheme other than file doesn't have a local file path.
* fixup! Change uri_to_fname to not convert non-file URIs
* fixup! fixup! Change uri_to_fname to not convert non-file URIs
Diffstat (limited to 'test/functional/lua/uri_spec.lua')
-rw-r--r-- | test/functional/lua/uri_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua index a3b8e685e1..f782769935 100644 --- a/test/functional/lua/uri_spec.lua +++ b/test/functional/lua/uri_spec.lua @@ -112,6 +112,29 @@ describe('URI methods', function() eq('C:\\xy\\åäö\\ɧ\\汉语\\↥\\🤦\\🦄\\å\\بِيَّ.txt', exec_lua(test_case)) end) end) + + describe('decode non-file URI', function() + it('uri_to_fname returns non-file URI unchanged', function() + eq('jdt1.23+x-z://content/%5C/', exec_lua [[ + return vim.uri_to_fname('jdt1.23+x-z://content/%5C/') + ]]) + end) + + it('uri_to_fname returns non-file upper-case scheme URI unchanged', function() + eq('JDT://content/%5C/', exec_lua [[ + return vim.uri_to_fname('JDT://content/%5C/') + ]]) + end) + end) + + describe('decode URI without scheme', function() + it('fails because URI must have a scheme', function() + eq(false, exec_lua [[ + return pcall(vim.uri_to_fname, 'not_an_uri.txt') + ]]) + end) + end) + end) describe('uri to bufnr', function() |