diff options
Diffstat (limited to 'test')
-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 |