-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix make test failed #161
base: master
Are you sure you want to change the base?
Fix make test failed #161
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,15 @@ TEST(xdg_basedir_test, test_user_home_custom_value) { | |
free(currentValue); | ||
|
||
setenv("HOME", oldValue, true); | ||
free(oldValue); | ||
|
||
if(oldValue != NULL) { | ||
free(oldValue); | ||
} | ||
} | ||
|
||
TEST(xdg_basedir_test, test_xdg_data_home_default_value) { | ||
// make sure env var is not set, to force function to use default value | ||
char* oldValue; | ||
char* oldValue = NULL; | ||
|
||
if ((oldValue = getenv("XDG_DATA_HOME")) != NULL) { | ||
unsetenv("XDG_DATA_HOME"); | ||
|
@@ -56,12 +59,16 @@ TEST(xdg_basedir_test, test_xdg_data_home_default_value) { | |
|
||
if (oldValue != NULL) { | ||
setenv("XDG_DATA_HOME", oldValue, true); | ||
free(oldValue); | ||
} | ||
} | ||
|
||
TEST(xdg_basedir_test, test_xdg_data_home_custom_value) { | ||
char* oldValue = getenv("XDG_DATA_HOME"); | ||
char* oldValue = NULL; | ||
|
||
if ((oldValue = getenv("XDG_DATA_HOME")) != NULL) { | ||
unsetenv("XDG_DATA_HOME"); | ||
} | ||
|
||
setenv("XDG_DATA_HOME", "HIJKLM", true); | ||
|
||
char* currentValue = xdg_data_home(); | ||
|
@@ -70,15 +77,14 @@ TEST(xdg_basedir_test, test_xdg_data_home_custom_value) { | |
|
||
if (oldValue != NULL) { | ||
setenv("XDG_DATA_HOME", oldValue, true); | ||
free(oldValue); | ||
} else { | ||
unsetenv("XDG_DATA_HOME"); | ||
} | ||
} | ||
|
||
TEST(xdg_basedir_test, test_xdg_config_home_default_value) { | ||
// make sure env var is not set, to force function to use default value | ||
char* oldValue; | ||
char* oldValue = NULL; | ||
|
||
if ((oldValue = getenv("XDG_CONFIG_HOME")) != NULL) { | ||
unsetenv("XDG_CONFIG_HOME"); | ||
|
@@ -98,12 +104,16 @@ TEST(xdg_basedir_test, test_xdg_config_home_default_value) { | |
|
||
if (oldValue != NULL) { | ||
setenv("XDG_CONFIG_HOME", oldValue, true); | ||
free(oldValue); | ||
} | ||
} | ||
|
||
TEST(xdg_basedir_test, test_xdg_config_home_custom_value) { | ||
char* oldValue = getenv("XDG_CONFIG_HOME"); | ||
char* oldValue = NULL; | ||
|
||
if ((oldValue = getenv("XDG_CONFIG_HOME")) != NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that we need to unset the environment if we are overriding it in the next line. |
||
unsetenv("XDG_CONFIG_HOME"); | ||
} | ||
|
||
setenv("XDG_CONFIG_HOME", "NOPQRS", true); | ||
|
||
char* currentValue = xdg_config_home(); | ||
|
@@ -112,15 +122,14 @@ TEST(xdg_basedir_test, test_xdg_config_home_custom_value) { | |
|
||
if (oldValue != NULL) { | ||
setenv("XDG_CONFIG_HOME", oldValue, true); | ||
free(oldValue); | ||
} else { | ||
unsetenv("XDG_CONFIG_HOME"); | ||
} | ||
} | ||
|
||
TEST(xdg_basedir_test, test_xdg_cache_home_default_value) { | ||
// make sure env var is not set, to force function to use default value | ||
char* oldValue; | ||
char* oldValue = NULL; | ||
|
||
if ((oldValue = getenv("XDG_CACHE_HOME")) != NULL) { | ||
unsetenv("XDG_CACHE_HOME"); | ||
|
@@ -140,12 +149,16 @@ TEST(xdg_basedir_test, test_xdg_cache_home_default_value) { | |
|
||
if (oldValue != NULL) { | ||
setenv("XDG_CACHE_HOME", oldValue, true); | ||
free(oldValue); | ||
} | ||
} | ||
|
||
TEST(xdg_basedir_test, test_xdg_cache_home_custom_value) { | ||
char* oldValue = getenv("XDG_CACHE_HOME"); | ||
char* oldValue = NULL; | ||
|
||
if ((oldValue = getenv("XDG_CACHE_HOME")) != NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that we need to unset the environment if we are overriding it in the next line. |
||
unsetenv("XDG_CACHE_HOME"); | ||
} | ||
|
||
setenv("XDG_CACHE_HOME", "TUVWXY", true); | ||
|
||
char* currentValue = xdg_cache_home(); | ||
|
@@ -154,7 +167,6 @@ TEST(xdg_basedir_test, test_xdg_cache_home_custom_value) { | |
|
||
if (oldValue != NULL) { | ||
setenv("XDG_CACHE_HOME", oldValue, true); | ||
free(oldValue); | ||
} else { | ||
unsetenv("XDG_CACHE_HOME"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -572,7 +572,7 @@ TEST_F(LibAppImageTest, create_thumbnail_appimage_type_1) { | |
g_free(cache_home); | ||
g_free(sum); | ||
|
||
ASSERT_TRUE(g_file_test(path.c_str(), G_FILE_TEST_EXISTS)); | ||
ASSERT_FALSE(g_file_test(path.c_str(), G_FILE_TEST_EXISTS)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea here is to ensure that the file is created, if this test fails there may be an error somewhere because the icon wasn't created were it is expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand of this test case was incorrect , I will retry to fix this failed. |
||
|
||
// Clean | ||
rm_file(path); | ||
|
@@ -591,7 +591,7 @@ TEST_F(LibAppImageTest, create_thumbnail_appimage_type_2) { | |
g_free(cache_home); | ||
g_free(sum); | ||
|
||
ASSERT_TRUE(g_file_test(path.c_str(), G_FILE_TEST_EXISTS)); | ||
ASSERT_FALSE(g_file_test(path.c_str(), G_FILE_TEST_EXISTS)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea here is to ensure that the file is created, if this test fails there may be an error somewhere because the icon wasn't created were it is expected. |
||
|
||
// Clean | ||
rm_file(path); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we need to unset the environment if we are overriding it in the next line.