summaryrefslogtreecommitdiff
path: root/test/plugins/ffi/parser.lua
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2023-05-12 16:54:03 +0800
committerfesily <fesil@foxmail.com>2023-05-12 16:54:03 +0800
commit9cc197aa5ca6c5e0314ec38266a2c0e022025307 (patch)
tree6b38fd2f3cdaf2528ee2b38037e6ceb50bac4e6c /test/plugins/ffi/parser.lua
parent74328ad18382623635f614fd31f559fe90469333 (diff)
downloadlua-language-server-9cc197aa5ca6c5e0314ec38266a2c0e022025307.zip
support array
Diffstat (limited to 'test/plugins/ffi/parser.lua')
-rw-r--r--test/plugins/ffi/parser.lua30
1 files changed, 28 insertions, 2 deletions
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',