diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dc2421..734fbeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,6 +188,7 @@ if(SLED_BUILD_TESTS) src/sled/utility/move_on_copy_test.cc) sled_add_test(NAME sled_symbolize_test SRCS src/sled/debugging/symbolize_test.cc NO_MAIN) + sled_add_test(NAME sled_sigslot_test SRCS src/sled/sigslot_test.cc) endif(SLED_BUILD_TESTS) if(SLED_BUILD_FUZZ) diff --git a/src/sled/sigslot_test.cc b/src/sled/sigslot_test.cc new file mode 100644 index 0000000..8efa501 --- /dev/null +++ b/src/sled/sigslot_test.cc @@ -0,0 +1,16 @@ +#include + +struct DeleteSelf : public sigslot::has_slots<> { + void DeleteThis() { + delete this; + } +}; + +TEST_SUITE("sigslot") { + TEST_CASE("delete this") { + DeleteSelf* d = new DeleteSelf(); + sigslot::signal0<> sig; + sig.connect(d, &DeleteSelf::DeleteThis); + sig.emit(); + } +}