test: Introduce Quassel::Test::Global library
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 30 Sep 2018 20:11:56 +0000 (22:11 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
Move things that are needed in every test case into a new library,
rather than requiring the Test::Main one (which is not going to be
linked to other test tooling which we'll introduce).

cmake/QuasselMacros.cmake
src/test/CMakeLists.txt
src/test/global/CMakeLists.txt [new file with mode: 0644]
src/test/global/testglobal.h [moved from src/test/main/testglobal.h with 97% similarity]
src/test/main/CMakeLists.txt

index 62ad20c..9f576cd 100644 (file)
@@ -200,6 +200,7 @@ function(quassel_add_test _target)
     list(APPEND ARG_LIBRARIES
         Qt5::Test
         Quassel::Common
+        Quassel::Test::Global
         Quassel::Test::Main
     )
 
index 9a263aa..ea61c43 100644 (file)
@@ -1 +1,2 @@
+add_subdirectory(global)
 add_subdirectory(main)
diff --git a/src/test/global/CMakeLists.txt b/src/test/global/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f3f4ed2
--- /dev/null
@@ -0,0 +1,13 @@
+quassel_add_module(Test::Global EXPORT NOINSTALL)
+
+target_sources(${TARGET} PRIVATE
+    testglobal.h
+)
+
+target_link_libraries(${TARGET}
+    PUBLIC
+        GTest::GTest
+        Qt5::Core
+        Qt5::Test
+        Quassel::Common
+)
similarity index 97%
rename from src/test/main/testglobal.h
rename to src/test/global/testglobal.h
index 33f1fb8..cc7ce97 100644 (file)
@@ -20,6 +20,6 @@
 
 #pragma once
 
-#include "test-main-export.h"
+#include "test-global-export.h"
 
 #include <gmock/gmock.h>
index 6d6993f..5d59063 100644 (file)
@@ -2,12 +2,10 @@ quassel_add_module(Test::Main EXPORT NOINSTALL)
 
 target_sources(${TARGET} PRIVATE
     main.cpp
-    testglobal.h
 )
 
 target_link_libraries(${TARGET}
     PUBLIC
-        GTest::GTest
         Qt5::Core
-        Quassel::Common
+        Quassel::Test::Global
 )