Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion include/nexus/detail/extend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ struct name_extend : stdx::with_name<Name>, config_item {
}
};

template <typename Service, typename... Args> struct type_extend : config_item {
template <typename Service> struct with_name_of {};
template <stdx::named Service>
struct with_name_of<Service> : stdx::with_name<stdx::name_of_v<Service>> {};

template <typename Service, typename... Args>
struct type_extend : with_name_of<Service>, config_item {
using service_type = Service;
stdx::tuple<Args...> args_tuple;

Expand Down
8 changes: 2 additions & 6 deletions test/flow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ function(add_debug_flow_test)
endif()
endfunction()

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 15)
add_debug_flow_test()
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
add_debug_flow_test()
endif()
12 changes: 2 additions & 10 deletions test/flow/fail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
function(add_formatted_errors_tests)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
add_compile_fail_test(cyclic_flow.cpp LIBRARIES cib_flow cib_nexus)
add_compile_fail_test(debug_subgraph.cpp LIBRARIES cib_flow cib_nexus)
add_compile_fail_test(only_reference_added.cpp LIBRARIES cib_flow cib_nexus)
add_compile_fail_test(mismatched_flow_runtime_conditional.cpp LIBRARIES
cib_flow cib_nexus)
add_compile_fail_test(node_explicitly_added_twice.cpp LIBRARIES cib_flow
cib_nexus)
endfunction()

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 15)
add_formatted_errors_tests()
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
add_formatted_errors_tests()
endif()
8 changes: 2 additions & 6 deletions test/interrupt/fail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 15)
add_compile_fail_test(nonexistent_flow.cpp LIBRARIES cib_interrupt)
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
add_compile_fail_test(nonexistent_flow.cpp LIBRARIES cib_interrupt)
endif()
5 changes: 5 additions & 0 deletions test/nexus/fail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_VERSION}
VERSION_GREATER_EQUAL 13.2)
add_compile_fail_test(extend_unexported_service.cpp LIBRARIES cib_nexus)
endif()

add_compile_fail_test(moveonly_multiple_callbacks.cpp LIBRARIES cib_nexus)
20 changes: 20 additions & 0 deletions test/nexus/fail/extend_unexported_service.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <nexus/callback.hpp>
#include <nexus/config.hpp>
#include <nexus/nexus.hpp>

// EXPECT: Trying to extend a service \(foo\) that is not exported

namespace {
struct cb : public callback::service<> {
constexpr static auto name = stdx::ct_string{"foo"};
};

struct extend_config {
constexpr static auto config = cib::config(cib::extend<cb>([]() {}));
};
} // namespace

auto main() -> int {
cib::nexus<extend_config> nexus{};
nexus.init();
}