From a965deaae2e546348b3079405a30c56756f5e956 Mon Sep 17 00:00:00 2001 From: Ivan FB Date: Sun, 31 May 2026 10:40:54 +0200 Subject: [PATCH] fix(tests): call renamed *CborExport entry points Commit f3206c3 split each FFI export into two distinctly-named Nim procs (`CborExport` / `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 (lib, ...)` calls keep the bare name on purpose. Co-Authored-By: Claude Opus 4.8 --- tests/unit/test_ctx_validation.nim | 4 ++-- tests/unit/test_ffi_context.nim | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit/test_ctx_validation.nim b/tests/unit/test_ctx_validation.nim index e7a4e10..69ba381 100644 --- a/tests/unit/test_ctx_validation.nim +++ b/tests/unit/test_ctx_validation.nim @@ -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 diff --git a/tests/unit/test_ffi_context.nim b/tests/unit/test_ffi_context.nim index f33f760..557951f 100644 --- a/tests/unit/test_ffi_context.nim +++ b/tests/unit/test_ffi_context.nim @@ -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