mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-07-01 13:50:09 +00:00
fix(tests): call renamed *CborExport entry points
Commit f3206c3 split each FFI export into two distinctly-named Nim procs (`<name>CborExport` / `<name>NativeExport`, and the ctor variants), so the bare user name now resolves only to the Nim-native helper. The C-shape integration tests still invoked the CBOR entry points by the bare name and no longer compiled. Point those call sites at the `*CborExport` / `*CborCtorExport` procs; the Nim-native `waitFor <name>(lib, ...)` calls keep the bare name on purpose. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f3206c30b8
commit
a965deaae2
@ -42,7 +42,7 @@ suite "ctx pointer validation at the FFI entry point":
|
||||
var s: CallbackState
|
||||
initCbState(s)
|
||||
let nilCtx: ptr FFIContext[TestLib] = nil
|
||||
let ret = ctxval_ping(nilCtx, validationCallback, addr s, nil, 0.csize_t)
|
||||
let ret = ctxval_pingCborExport(nilCtx, validationCallback, addr s, nil, 0.csize_t)
|
||||
check ret == RET_ERR
|
||||
check s.called.load()
|
||||
check s.retCode == RET_ERR
|
||||
@ -51,7 +51,7 @@ suite "ctx pointer validation at the FFI entry point":
|
||||
var s: CallbackState
|
||||
initCbState(s)
|
||||
let invalidCtx = cast[ptr FFIContext[TestLib]](123)
|
||||
let ret = ctxval_ping(invalidCtx, validationCallback, addr s, nil, 0.csize_t)
|
||||
let ret = ctxval_pingCborExport(invalidCtx, validationCallback, addr s, nil, 0.csize_t)
|
||||
check ret == RET_ERR
|
||||
check s.called.load()
|
||||
check s.retCode == RET_ERR
|
||||
|
||||
@ -359,7 +359,7 @@ suite "ffiCtor macro":
|
||||
deinitCallbackData(d)
|
||||
|
||||
var cfg = cborEncode(TestlibCreateCtorReq(config: SimpleConfig(initialValue: 42)))
|
||||
let ret = testlib_create(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr d)
|
||||
let ret = testlib_createCborCtorExport(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr d)
|
||||
|
||||
check not ret.isNil()
|
||||
|
||||
@ -396,7 +396,7 @@ suite "simplified .ffi. macro":
|
||||
|
||||
var cfg = cborEncode(TestlibCreateCtorReq(config: SimpleConfig(initialValue: 7)))
|
||||
let ctorRet =
|
||||
testlib_create(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr ctorD)
|
||||
testlib_createCborCtorExport(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr ctorD)
|
||||
check not ctorRet.isNil()
|
||||
|
||||
waitCallback(ctorD)
|
||||
@ -415,7 +415,7 @@ suite "simplified .ffi. macro":
|
||||
|
||||
# The .ffi. macro packs all extra params into one CBOR Req struct.
|
||||
var reqBytes = cborEncode(TestlibSendReq(cfg: SendConfig(message: "hello")))
|
||||
let ret = testlib_send(
|
||||
let ret = testlib_sendCborExport(
|
||||
ctx, testCallback, addr d, encodedPtr(reqBytes), reqBytes.len.csize_t
|
||||
)
|
||||
check ret == RET_OK
|
||||
@ -441,7 +441,7 @@ suite "sync-body .ffi. is dispatched on FFI thread":
|
||||
|
||||
var cfg = cborEncode(TestlibCreateCtorReq(config: SimpleConfig(initialValue: 3)))
|
||||
let ctorRet =
|
||||
testlib_create(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr ctorD)
|
||||
testlib_createCborCtorExport(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr ctorD)
|
||||
check not ctorRet.isNil()
|
||||
|
||||
waitCallback(ctorD)
|
||||
@ -460,7 +460,7 @@ suite "sync-body .ffi. is dispatched on FFI thread":
|
||||
|
||||
# No-extra-param .ffi. proc; pack an empty Req.
|
||||
var emptyBytes = cborEncode(TestlibVersionReq())
|
||||
let ret = testlib_version(
|
||||
let ret = testlib_versionCborExport(
|
||||
ctx, testCallback, addr d2, encodedPtr(emptyBytes), emptyBytes.len.csize_t
|
||||
)
|
||||
check ret == RET_OK
|
||||
@ -524,7 +524,7 @@ suite "sync-body .ffi. runs on FFI thread (PR #23 regression)":
|
||||
|
||||
var cfg = cborEncode(TestlibCreateCtorReq(config: SimpleConfig(initialValue: 0)))
|
||||
let ctorRet =
|
||||
testlib_create(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr ctorD)
|
||||
testlib_createCborCtorExport(encodedPtr(cfg), cfg.len.csize_t, testCallback, addr ctorD)
|
||||
check not ctorRet.isNil()
|
||||
waitCallback(ctorD)
|
||||
check ctorD.retCode == RET_OK
|
||||
@ -543,7 +543,7 @@ suite "sync-body .ffi. runs on FFI thread (PR #23 regression)":
|
||||
deinitCallbackData(d)
|
||||
|
||||
var reqBytes = cborEncode(TestlibRecordTidReq(req: RecordTidReq(dummy: 1)))
|
||||
let ret = testlib_record_tid(
|
||||
let ret = testlib_record_tidCborExport(
|
||||
ctx, testCallback, addr d, encodedPtr(reqBytes), reqBytes.len.csize_t
|
||||
)
|
||||
check ret == RET_OK
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user