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/parser.lua | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'test/plugins/ffi/parser.lua') 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', -- cgit v1.2.3