@@ -26,11 +26,17 @@ void test_basic() {
2626 " /TEST/PATH1/:/TEST/PATH2:/TEST/PATH2/:/TEST/PATH1" );
2727 setEnvironment (" XDG_DATA_HOME" , " /TEST//PATH" );
2828 setEnvironment (" XDG_DATA_DIRS" , TEST_ADDON_DIR);
29+ setEnvironment (" XDG_CACHE_HOME" , " /CACHE/PATH" );
30+ setEnvironment (" XDG_RUNTIME_DIR" , " /RUNTIME/PATH" );
2931 StandardPaths standardPaths (" fcitx5" , {},
3032 StandardPathsOption::SkipBuiltInPath);
3133
3234 FCITX_ASSERT (standardPaths.userDirectory (StandardPathsType::Config) ==
3335 " /TEST/PATH" );
36+ FCITX_ASSERT (standardPaths.userDirectory (StandardPathsType::Runtime) ==
37+ " /RUNTIME/PATH" );
38+ FCITX_ASSERT (standardPaths.userDirectory (StandardPathsType::Cache) ==
39+ " /CACHE/PATH" );
3440 // The order to the path should be kept for their first appearance.
3541 FCITX_ASSERT (
3642 std::ranges::equal (standardPaths.directories (StandardPathsType::Config),
@@ -108,10 +114,15 @@ void test_nouser() {
108114 setEnvironment (" XDG_CONFIG_DIRS" , " /TEST/PATH1:/TEST/PATH2" );
109115 setEnvironment (" XDG_DATA_HOME" , " /TEST//PATH" );
110116 setEnvironment (" XDG_DATA_DIRS" , TEST_ADDON_DIR);
117+ setEnvironment (" XDG_CACHE_HOME" , " /CACHE/PATH" );
118+ setEnvironment (" XDG_RUNTIME_DIR" , " /RUNTIME/PATH" );
111119 StandardPaths standardPaths (
112120 " fcitx5" , {},
113121 StandardPathsOptions{StandardPathsOption::SkipUserPath,
114122 StandardPathsOption::SkipBuiltInPath});
123+ FCITX_ASSERT (
124+ standardPaths.userDirectory (StandardPathsType::Runtime).empty ());
125+ FCITX_ASSERT (standardPaths.userDirectory (StandardPathsType::Cache).empty ());
115126
116127 std::filesystem::path path;
117128 auto file =
0 commit comments