From 3ee85a685bf13c6ae56824b477a4a146a44ba8a2 Mon Sep 17 00:00:00 2001
From: Sebastian Eibl <sebastian.eibl@mpcdf.mpg.de>
Date: Thu, 2 Feb 2023 11:50:49 +0100
Subject: [PATCH] add never running test

---
 08_ctest/CMakeLists.txt       | 4 ++++
 08_ctest/tests/CMakeLists.txt | 6 ++++++
 08_ctest/tests/never_run.cpp  | 6 ++++++
 3 files changed, 16 insertions(+)
 create mode 100644 08_ctest/tests/CMakeLists.txt
 create mode 100644 08_ctest/tests/never_run.cpp

diff --git a/08_ctest/CMakeLists.txt b/08_ctest/CMakeLists.txt
index 768812e..e1f8c8a 100644
--- a/08_ctest/CMakeLists.txt
+++ b/08_ctest/CMakeLists.txt
@@ -8,6 +8,10 @@ add_executable(success success.cpp)
 # create an executable that returns failure
 add_executable(failure failure.cpp)
 
+# Tests in this subdirectory will never be called since CTest is not yet
+# included!
+add_subdirectory(tests)
+
 # Make sure to include CTest before adding any test with add_test
 # otherwise the tests will not be registered.
 include(CTest)
diff --git a/08_ctest/tests/CMakeLists.txt b/08_ctest/tests/CMakeLists.txt
new file mode 100644
index 0000000..fb3d049
--- /dev/null
+++ b/08_ctest/tests/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_executable(never_run never_run.cpp)
+
+add_test(
+    NAME never_run
+    COMMAND never_run )
+
diff --git a/08_ctest/tests/never_run.cpp b/08_ctest/tests/never_run.cpp
new file mode 100644
index 0000000..859e653
--- /dev/null
+++ b/08_ctest/tests/never_run.cpp
@@ -0,0 +1,6 @@
+#include <cstdlib>
+
+int main()
+{
+    return EXIT_SUCCESS;
+}
-- 
GitLab