From 5a4241a0cc38fa09ad0e08eae34fb8a05656c9c2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 15 Jun 2026 12:09:33 +0200 Subject: [PATCH] Add missing tests stubs --- tests/CMakeLists.txt | 2 ++ tests/event_stubs.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/event_stubs.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 01a4ea8..337eef9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -12,6 +12,7 @@ logos_test( TEST_SOURCES main.cpp test_blockchain.cpp + event_stubs.cpp MOCK_C_SOURCES mocks/mock_logos_blockchain.cpp EXTRA_INCLUDES @@ -35,6 +36,7 @@ if(LIBLOGOS_BLOCKCHAIN_PATH) TEST_SOURCES main.cpp test_blockchain.cpp + event_stubs.cpp EXTRA_INCLUDES ../lib EXTRA_LINK_LIBS diff --git a/tests/event_stubs.cpp b/tests/event_stubs.cpp new file mode 100644 index 0000000..f68110c --- /dev/null +++ b/tests/event_stubs.cpp @@ -0,0 +1,17 @@ +// Test-only definitions for `logos_events:` methods. +// +// In a real build the cpp-generator emits the bodies of every `logos_events:` +// method into a sidecar `_events.cpp` (each forwards through +// `emitEventImpl_`). The unit/integration test targets compile the module +// source directly without running codegen, so those bodies are absent and the +// link fails on `on_new_block_callback`'s reference to `newBlock`. +// +// `emitEventImpl_` is a no-op outside a framework-provisioned context (no emit +// callback is installed in tests), so forwarding here mirrors production +// behaviour while keeping the test build link-complete. + +#include "logos_blockchain_module.h" + +void LogosBlockchainModule::newBlock(const std::string& blockJson) { + emitEventImpl_("newBlock", nullptr); +}