diff options
author | fesily <fesil@foxmail.com> | 2023-05-12 16:54:03 +0800 |
---|---|---|
committer | fesily <fesil@foxmail.com> | 2023-05-12 16:54:03 +0800 |
commit | 9cc197aa5ca6c5e0314ec38266a2c0e022025307 (patch) | |
tree | 6b38fd2f3cdaf2528ee2b38037e6ceb50bac4e6c /test/plugins | |
parent | 74328ad18382623635f614fd31f559fe90469333 (diff) | |
download | lua-language-server-9cc197aa5ca6c5e0314ec38266a2c0e022025307.zip |
support array
Diffstat (limited to 'test/plugins')
-rw-r--r-- | test/plugins/ffi/builder.lua | 18 | ||||
-rw-r--r-- | test/plugins/ffi/parser.lua | 30 | ||||
-rw-r--r-- | test/plugins/ffi/test.lua (renamed from test/plugins/ffi/init.lua) | 0 |
3 files changed, 46 insertions, 2 deletions
diff --git a/test/plugins/ffi/builder.lua b/test/plugins/ffi/builder.lua index 47e39db3..a8fc115b 100644 --- a/test/plugins/ffi/builder.lua +++ b/test/plugins/ffi/builder.lua @@ -40,6 +40,24 @@ function TEST(wanted) end TEST [[ + ---@param a integer[][] + function m.test(a) end +]][[ + void test(int a[][]); +]] + +TEST [[ + ---@class ffi.namespace*.struct@A + ---@field b integer[] + ---@field c integer[] +]] [[ + struct A { + int b[5]; + int c[]; + }; +]] + +TEST [[ m.B = 5 m.A = 0 m.D = 7 diff --git a/test/plugins/ffi/parser.lua b/test/plugins/ffi/parser.lua index 983b64c3..6d7f2cea 100644 --- a/test/plugins/ffi/parser.lua +++ b/test/plugins/ffi/parser.lua @@ -5,20 +5,46 @@ rawset(_G, 'TEST', true) local ctypes = require 'plugins.ffi.c-parser.ctypes' ctypes.TESTMODE = true +--TODO expand all singlenode function TEST(wanted, full) return function (script) local rrr = cdriver.process_context(script .. "$EOF$") assert(rrr) if full then for i, v in ipairs(rrr) do - assert(utility.equal(v, wanted[i])) + assert(utility.equal(v, wanted[i]), utility.dump(v)) end else - assert(utility.equal(rrr[1], wanted)) + assert(utility.equal(rrr[1], wanted), utility.dump(rrr[1])) end end end +TEST { + name = "struct@A", + type = { + fields = { + { + isarray = true, + name = "a", + type = { "int", }, + }, + { + isarray = true, + name = "b", + type = { "int", }, + }, + }, + name = "A", + type = "struct", + }, +} + [[ + struct A { + int a[5]; + int b[]; + }; +]] TEST { name = 'union@a', diff --git a/test/plugins/ffi/init.lua b/test/plugins/ffi/test.lua index 2a232192..2a232192 100644 --- a/test/plugins/ffi/init.lua +++ b/test/plugins/ffi/test.lua |