aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2018-12-15 12:07:00 +0100
committerFelix Morgner <felix.morgner@gmail.com>2018-12-15 12:07:00 +0100
commit9941c06c33c601a3e59c008c35c6181ba8a2e7f9 (patch)
treee5a71e5a3d3c541c82077695a0c302cfa952051d /tests
parented419140280553b070943b7ba539120a26ff5686 (diff)
downloadwanda-9941c06c33c601a3e59c008c35c6181ba8a2e7f9.tar.xz
wanda-9941c06c33c601a3e59c008c35c6181ba8a2e7f9.zip
testing: rework test code
Diffstat (limited to 'tests')
-rw-r--r--tests/wanda/driver.cpp (renamed from tests/wanda/core_driver.cpp)13
-rw-r--r--tests/wanda/test_suite_xdg.cpp9
-rw-r--r--tests/wanda/test_suite_xdg.hpp16
3 files changed, 14 insertions, 24 deletions
diff --git a/tests/wanda/core_driver.cpp b/tests/wanda/driver.cpp
index 3643da0..e0dd7c8 100644
--- a/tests/wanda/core_driver.cpp
+++ b/tests/wanda/driver.cpp
@@ -1,5 +1,3 @@
-#include "test_suite_xdg.hpp"
-
#include "cute/cute.h"
#include "cute/cute_runner.h"
#include "cute/tap_listener.h"
@@ -7,12 +5,19 @@
#include <algorithm>
#include <iostream>
#include <iterator>
+#include <string>
+#include <utility>
#include <vector>
+namespace wanda::test
+{
+ std::pair<cute::suite, std::string> suite();
+}
+
int main(int argc, char const *const *argv)
{
auto listener = cute::tap_listener<>{std::cout};
auto runner = cute::makeRunner(listener, argc, argv);
- auto suites = std::vector<std::pair<cute::suite, std::string>>{wanda::test_suite_xdg()};
- return !all_of(cbegin(suites), cend(suites), [&](auto const &suite) { return runner(suite.first, suite.second.c_str()); });
+ auto suite = wanda::test::suite();
+ return !runner(suite.first, suite.second.c_str());
} \ No newline at end of file
diff --git a/tests/wanda/test_suite_xdg.cpp b/tests/wanda/test_suite_xdg.cpp
index 0338ee3..70597f7 100644
--- a/tests/wanda/test_suite_xdg.cpp
+++ b/tests/wanda/test_suite_xdg.cpp
@@ -1,13 +1,14 @@
-#include "test_suite_xdg.hpp"
#include <wanda/xdg.hpp>
-#include "cute/cute.h"
+#include <cute/cute.h>
#include <unistd.h>
#include <filesystem>
+#include <string>
+#include <utility>
-namespace wanda
+namespace wanda::test
{
namespace
@@ -76,7 +77,7 @@ void test_xdg_path_for_runtime_dir_with_xdg_runtime_dir_in_environment()
ASSERT_EQUAL("/home/cute/xdg_runtime_dir", xdg_path_for(xdg_directory::runtime_dir, env));
}
-std::pair<cute::suite, std::string> test_suite_xdg()
+std::pair<cute::suite, std::string> suite()
{
return std::make_pair(cute::suite{
CUTE(test_xdg_variables),
diff --git a/tests/wanda/test_suite_xdg.hpp b/tests/wanda/test_suite_xdg.hpp
deleted file mode 100644
index 698ad9a..0000000
--- a/tests/wanda/test_suite_xdg.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef WANDA_TEST_SUITE_XDG_HPP
-#define WANDA_TEST_SUITE_XDG_HPP
-
-#include "cute/cute.h"
-
-#include <string>
-#include <utility>
-
-namespace wanda
-{
-
-std::pair<cute::suite, std::string> test_suite_xdg();
-
-} // namespace wanda
-
-#endif \ No newline at end of file