Build: gate reflection-only tests on VOID_HAS_CXX26_REFLECTION (refs #38)

This commit is contained in:
faumaray committed 2026-12-03 17:29:04 +03:00
1 parent b1933d9906
commit 1ba60d5d6a
19 files changed
+56 -12

No files matched your search

+17
View File
@@ -11,6 +11,21 @@ get_property(ACTIVE_HEADERS GLOBAL PROPERTY VOID_ACTIVE_PUBLIC_HEADERS)
function(_void_test_requires_satisfied src_file active_modules active_headers out_var)
file(READ "${src_file}" _src_content)
# Whole-file capability gates. The test scanner is line-based and does not
# evaluate preprocessor conditionals, so a file whose tests live inside
# `#ifdef VOID_HAS_*_REFLECTION` would still get registrations generated
# for functions that are not defined. Such files declare
# `// @requires-reflection` and are skipped when the compiler cannot do
# C++26 reflection.
if(NOT VOID_HAS_CXX26_REFLECTION)
string(FIND "${_src_content}" "// @requires-reflection" _needs_reflection)
if(NOT _needs_reflection EQUAL -1)
message(STATUS
"[VoidTests] Skipping ${src_file} (requires C++26 reflection)")
set(${out_var} FALSE PARENT_SCOPE)
return()
endif()
endif()
string(REGEX MATCHALL "#[ \t]*include[ \t]*[<\"](Void/[^/\">]+/[^>\"]+)[>\"]"
_matches "${_src_content}")
set(_ok TRUE)
@@ -118,6 +133,8 @@ if(_all_generated)
set_target_properties(VoidTests PROPERTIES VOID_TESTING_NO_AUTO_SCAN TRUE)
target_link_libraries(VoidTests PRIVATE Void::Testing)
target_compile_definitions(VoidTests PRIVATE
"VOID_HAS_CXX26_REFLECTION=$<BOOL:${VOID_HAS_CXX26_REFLECTION}>")
foreach(mod ${ACTIVE_MODULES})
if(NOT mod STREQUAL "Testing" AND TARGET Void::${mod})
target_link_libraries(VoidTests PRIVATE Void::${mod})
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Configuration/Argparse.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Configuration/Bind.hpp>
#include <Void/Configuration/Config.hpp>
#include <Void/Testing/Assert.hpp>
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Configuration/Bind.hpp>
#include <Void/Configuration/Config.hpp>
#include <Void/Testing/Assert.hpp>
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Configuration/Bind.hpp>
#include <Void/Configuration/Config.hpp>
#include <Void/Configuration/Schema.hpp>
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Async/Executor.hpp>
#include <Void/Async/Task.hpp>
#include <Void/Configuration/ReloadController.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Core/Flags.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Core/Meta.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Data/Csv.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Data/Reflect.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Data/Reflect.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Data/Reflect.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Suite.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Fsm/Fsm.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Async/Executor.hpp>
#include <Void/Async/Task.hpp>
#include <Void/Data/Reflect.hpp>
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Functional/Detail/Repr.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Suite.hpp>
+1
View File
@@ -1,3 +1,4 @@
// @requires-reflection
#include <Void/TestingMock/Reflect.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Suite.hpp>