aboutsummaryrefslogtreecommitdiff
path: root/source/tests/wanda/test_suite_xdg.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2023-09-05 15:03:13 +0200
committerFelix Morgner <felix.morgner@gmail.com>2023-09-05 15:03:13 +0200
commitb0003d8680669ac7c3b0ca202f9d7442d57ad42e (patch)
treeb77149f000ba1e6685c90afe3d2677bf8bae5d5d /source/tests/wanda/test_suite_xdg.cpp
parentd49757887e4161e664fe30649c1c9f31a0338bdf (diff)
downloadwanda-b0003d8680669ac7c3b0ca202f9d7442d57ad42e.tar.xz
wanda-b0003d8680669ac7c3b0ca202f9d7442d57ad42e.zip
tests: revice XDG unit tests
Diffstat (limited to 'source/tests/wanda/test_suite_xdg.cpp')
-rw-r--r--source/tests/wanda/test_suite_xdg.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/source/tests/wanda/test_suite_xdg.cpp b/source/tests/wanda/test_suite_xdg.cpp
deleted file mode 100644
index 70597f7..0000000
--- a/source/tests/wanda/test_suite_xdg.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <wanda/xdg.hpp>
-
-#include <cute/cute.h>
-
-#include <unistd.h>
-
-#include <filesystem>
-#include <string>
-#include <utility>
-
-namespace wanda::test
-{
-
-namespace
-{
- char const * home_only_environment[2] = {"HOME=/home/cute"};
- char const * xdg_data_home_environment[2] = {"XDG_DATA_HOME=/home/cute/xdg_data_home"};
- char const * xdg_config_home_environment[2] = {"XDG_CONFIG_HOME=/home/cute/xdg_config_home"};
- char const * xdg_cache_home_environment[2] = {"XDG_CACHE_HOME=/home/cute/xdg_cache_home"};
- char const * xdg_runtime_dir_environment[2] = {"XDG_RUNTIME_DIR=/home/cute/xdg_runtime_dir"};
-}
-
-void test_xdg_variables()
-{
- ASSERT_EQUAL("XDG_DATA_HOME", xdg_variable(xdg_directory::data_home));
- ASSERT_EQUAL("XDG_CONFIG_HOME", xdg_variable(xdg_directory::config_home));
- ASSERT_EQUAL("XDG_CACHE_HOME", xdg_variable(xdg_directory::cache_home));
- ASSERT_EQUAL("XDG_RUNTIME_DIR", xdg_variable(xdg_directory::runtime_dir));
-}
-
-void test_xdg_path_for_data_home_without_xdg_data_home_in_environment()
-{
- auto env = environment{home_only_environment};
- ASSERT_EQUAL("/home/cute/.local/share", xdg_path_for(xdg_directory::data_home, env));
-}
-
-void test_xdg_path_for_data_home_with_xdg_data_home_in_environment()
-{
- auto env = environment{xdg_data_home_environment};
- ASSERT_EQUAL("/home/cute/xdg_data_home", xdg_path_for(xdg_directory::data_home, env));
-}
-
-void test_xdg_path_for_config_home_without_xdg_config_home_in_environment()
-{
- auto env = environment{home_only_environment};
- ASSERT_EQUAL("/home/cute/.config", xdg_path_for(xdg_directory::config_home, env));
-}
-
-void test_xdg_path_for_config_home_with_xdg_config_home_in_environment()
-{
- auto env = environment{xdg_config_home_environment};
- ASSERT_EQUAL("/home/cute/xdg_config_home", xdg_path_for(xdg_directory::config_home, env));
-}
-
-void test_xdg_path_for_cache_home_without_xdg_cache_home_in_environment()
-{
- auto env = environment{home_only_environment};
- ASSERT_EQUAL("/home/cute/.cache", xdg_path_for(xdg_directory::cache_home, env));
-}
-
-void test_xdg_path_for_cache_home_with_xdg_cache_home_in_environment()
-{
- auto env = environment{xdg_cache_home_environment};
- ASSERT_EQUAL("/home/cute/xdg_cache_home", xdg_path_for(xdg_directory::cache_home, env));
-}
-
-void test_xdg_path_for_runtime_dir_without_xdg_runtime_dir_in_environment()
-{
- auto env = environment{home_only_environment};
- auto expected = std::filesystem::path{"/run/user"} / std::to_string(::getuid());
- ASSERT_EQUAL(expected, xdg_path_for(xdg_directory::runtime_dir, env));
-}
-
-void test_xdg_path_for_runtime_dir_with_xdg_runtime_dir_in_environment()
-{
- auto env = environment{xdg_runtime_dir_environment};
- ASSERT_EQUAL("/home/cute/xdg_runtime_dir", xdg_path_for(xdg_directory::runtime_dir, env));
-}
-
-std::pair<cute::suite, std::string> suite()
-{
- return std::make_pair(cute::suite{
- CUTE(test_xdg_variables),
- CUTE(test_xdg_path_for_data_home_without_xdg_data_home_in_environment),
- CUTE(test_xdg_path_for_data_home_with_xdg_data_home_in_environment),
- CUTE(test_xdg_path_for_config_home_without_xdg_config_home_in_environment),
- CUTE(test_xdg_path_for_config_home_with_xdg_config_home_in_environment),
- CUTE(test_xdg_path_for_cache_home_without_xdg_cache_home_in_environment),
- CUTE(test_xdg_path_for_cache_home_with_xdg_cache_home_in_environment),
- CUTE(test_xdg_path_for_runtime_dir_without_xdg_runtime_dir_in_environment),
- CUTE(test_xdg_path_for_runtime_dir_with_xdg_runtime_dir_in_environment),
- },
- "XDG Utilities");
-}
-
-} // namespace wanda \ No newline at end of file