From 9cc197aa5ca6c5e0314ec38266a2c0e022025307 Mon Sep 17 00:00:00 2001 From: fesily Date: Fri, 12 May 2023 16:54:03 +0800 Subject: support array --- test/plugins/ffi/test.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 test/plugins/ffi/test.lua (limited to 'test/plugins/ffi/test.lua') diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua new file mode 100644 index 00000000..2a232192 --- /dev/null +++ b/test/plugins/ffi/test.lua @@ -0,0 +1,37 @@ +local lclient = require 'lclient' +local ws = require 'workspace' +local furi = require 'file-uri' +local files = require 'files' + +--TODO how to changed the runtime version? +local template = require 'config.template' + +template['Lua.runtime.version'].default = 'LuaJIT' + + +---@async +local function TestBuilder() + local builder = require 'plugins.ffi'.initBuilder() + files.setText(TESTURI, [[ + local ffi = require 'ffi' + ffi.cdef 'void test();' + ]]) + + builder(TESTURI) +end + +---@async +lclient():start(function (languageClient) + languageClient:registerFakers() + local rootUri = furi.encode '/' + languageClient:initialize { + rootUri = rootUri, + } + + ws.awaitReady(rootUri) + + require 'plugins.ffi.cdef' + require 'plugins.ffi.parser' + require 'plugins.ffi.builder' + TestBuilder() +end) -- cgit v1.2.3 From 622b1745973b409e16a9a0db5ed25a0548337e59 Mon Sep 17 00:00:00 2001 From: fesily Date: Thu, 25 May 2023 15:52:12 +0800 Subject: command:add reloadFFIMeta --- test/plugins/ffi/test.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/plugins/ffi/test.lua') diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua index 2a232192..68cec156 100644 --- a/test/plugins/ffi/test.lua +++ b/test/plugins/ffi/test.lua @@ -8,16 +8,15 @@ local template = require 'config.template' template['Lua.runtime.version'].default = 'LuaJIT' - ---@async local function TestBuilder() - local builder = require 'plugins.ffi'.initBuilder() + local builder = require 'core.command.reloadFFIMeta' files.setText(TESTURI, [[ local ffi = require 'ffi' ffi.cdef 'void test();' ]]) - - builder(TESTURI) + local uri = ws.getFirstScope().uri + builder(uri) end ---@async -- cgit v1.2.3 From 7e56bc0fab89dc34f009a18f066a08e23f6e4838 Mon Sep 17 00:00:00 2001 From: fesily Date: Thu, 1 Jun 2023 10:45:16 +0800 Subject: ffi:fix build path --- test/plugins/ffi/test.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/plugins/ffi/test.lua') diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua index 68cec156..b46fe962 100644 --- a/test/plugins/ffi/test.lua +++ b/test/plugins/ffi/test.lua @@ -8,6 +8,8 @@ local template = require 'config.template' template['Lua.runtime.version'].default = 'LuaJIT' +TESTURI = furi.encode('/unittest.ffi.lua') + ---@async local function TestBuilder() local builder = require 'core.command.reloadFFIMeta' -- cgit v1.2.3 From 0108cc7c485a2885976d33e2da9419b97223e66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 19 Jul 2023 15:55:30 +0800 Subject: cleanup test codes --- test/plugins/ffi/test.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/plugins/ffi/test.lua') diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua index b46fe962..f07e71c6 100644 --- a/test/plugins/ffi/test.lua +++ b/test/plugins/ffi/test.lua @@ -8,7 +8,7 @@ local template = require 'config.template' template['Lua.runtime.version'].default = 'LuaJIT' -TESTURI = furi.encode('/unittest.ffi.lua') +TESTURI = furi.encode(TESTROOT .. 'unittest.ffi.lua') ---@async local function TestBuilder() -- cgit v1.2.3 From 010a8036ca2a2c2ec249cfe3b6eea0b343d49e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 24 Aug 2023 17:54:10 +0800 Subject: fix wrong uri in test --- test/plugins/ffi/test.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/plugins/ffi/test.lua') diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua index f07e71c6..7c17cb6d 100644 --- a/test/plugins/ffi/test.lua +++ b/test/plugins/ffi/test.lua @@ -24,7 +24,7 @@ end ---@async lclient():start(function (languageClient) languageClient:registerFakers() - local rootUri = furi.encode '/' + local rootUri = TESTURI languageClient:initialize { rootUri = rootUri, } -- cgit v1.2.3 From adde1d0a5001de44c8ee331f671668d509e23ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 7 Oct 2023 10:22:09 +0800 Subject: pause diagnostic in tests --- test/plugins/ffi/test.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/plugins/ffi/test.lua') diff --git a/test/plugins/ffi/test.lua b/test/plugins/ffi/test.lua index 7c17cb6d..93be2ff5 100644 --- a/test/plugins/ffi/test.lua +++ b/test/plugins/ffi/test.lua @@ -2,6 +2,7 @@ local lclient = require 'lclient' local ws = require 'workspace' local furi = require 'file-uri' local files = require 'files' +local diagnostic = require 'provider.diagnostic' --TODO how to changed the runtime version? local template = require 'config.template' @@ -29,10 +30,14 @@ lclient():start(function (languageClient) rootUri = rootUri, } + diagnostic.pause() + ws.awaitReady(rootUri) require 'plugins.ffi.cdef' require 'plugins.ffi.parser' require 'plugins.ffi.builder' TestBuilder() + + diagnostic.resume() end) -- cgit v1.2.3