diff options
Diffstat (limited to 'test/functional/lua')
-rw-r--r-- | test/functional/lua/uri_spec.lua | 9 | ||||
-rw-r--r-- | test/functional/lua/vim_spec.lua | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua index 19b1eb1f61..128c7c6137 100644 --- a/test/functional/lua/uri_spec.lua +++ b/test/functional/lua/uri_spec.lua @@ -85,6 +85,15 @@ describe('URI methods', function() 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' + return vim.uri_to_fname(uri) + ]] + + eq('C:\\Foo\\Bar\\Baz.txt', exec_lua(test_case)) + end) + it('file path including white space', function() local test_case = [[ local uri = 'file:///C:/Foo%20/Bar/Baz.txt' diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 5ce4bf2973..ca74d185cd 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -341,6 +341,22 @@ describe('lua stdlib', function() and vim.tbl_count(b) == 2 and tostring(a) ~= tostring(b) ]])) + + ok(exec_lua([[ + local f1 = function() return 1 end + local f2 = function() return 2 end + local t1 = {f = f1} + local t2 = vim.deepcopy(t1) + t1.f = f2 + return t1.f() ~= t2.f() + ]])) + + eq('Error executing lua: .../shared.lua: Cannot deepcopy object of type thread', + pcall_err(exec_lua, [[ + local thread = coroutine.create(function () return 0 end) + local t = {thr = thread} + vim.deepcopy(t) + ]])) end) it('vim.pesc', function() |