From a4e4609d62c38b7b949e5c8079dfa5f10803bdcd Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Wed, 24 Aug 2022 07:38:06 +0100 Subject: fix(path): path_is_url returns false for "foo:/" #19797 Problem: path_to_url() returns false for single-slash URIs ("foo:/" vs "foo://"). This is not compliant with the URI spec. https://url.spec.whatwg.org/#url-representation LSP in particular allows single-slash URIs. Solution: Relax path_to_url() to accept single-slash URIs. This is not fully compliant (only ":" is required by the spec), but it is hopefully good enough without causing false-positives in typical text files. ref https://url.spec.whatwg.org/#windows-drive-letter ref https://github.com/neovim/neovim/pull/19773 ref https://github.com/neovim/neovim/pull/19773#issuecomment-1214763769 --- test/unit/path_spec.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/unit') diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index fb476397e6..eb23a3cff1 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -640,6 +640,10 @@ describe('path.c', function() eq(2, path_with_url([[test-abc:\\xyz\foo\b3]])) eq(0, path_with_url([[-test://xyz/foo/b4]])) eq(0, path_with_url([[test-://xyz/foo/b5]])) + eq(1, path_with_url([[test-C:/xyz/foo/b5]])) + eq(1, path_with_url([[test-custom:/xyz/foo/b5]])) + eq(0, path_with_url([[c:/xyz/foo/b5]])) + eq(0, path_with_url([[C:/xyz/foo/b5]])) end) end) end) -- cgit From 73207cae611a1efb8cd17139e8228772daeb9866 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 26 Aug 2022 23:11:25 +0200 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- test/unit/message_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit') diff --git a/test/unit/message_spec.lua b/test/unit/message_spec.lua index 7e92b5c857..549eff6e03 100644 --- a/test/unit/message_spec.lua +++ b/test/unit/message_spec.lua @@ -22,7 +22,7 @@ describe('trunc_string', function() local function test_copy(s, expected, room) room = room and room or 20 local buf = cimp.xmalloc(ffi.sizeof('char_u') * buflen) - local str = cimp.vim_strsave(to_cstr(s)) + local str = cimp.xstrdup(to_cstr(s)) cimp.trunc_string(str, buf, room, buflen) eq(expected, ffi.string(buf)) cimp.xfree(buf) -- cgit