summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2015-12-02 17:56:25 +0100
committerDave Davenport <qball@gmpclient.org>2015-12-02 17:56:25 +0100
commite4c7fe8f1e548ab14f28c9cf54f169659c45b9fe (patch)
tree61c0b33aded5ac94958a00cfef02d8ef8db669a8
parent91e0f6b5559f724fe1f8833e4690365e5060c587 (diff)
Fix func. def in wrong header file.
-rw-r--r--include/helper.h8
-rw-r--r--include/rofi.h9
-rw-r--r--test/helper-test.c10
3 files changed, 17 insertions, 10 deletions
diff --git a/include/helper.h b/include/helper.h
index 64551623..7f3e1776 100644
--- a/include/helper.h
+++ b/include/helper.h
@@ -151,4 +151,12 @@ char helper_parse_char ( const char *arg );
*/
void cmd_set_arguments ( int argc, char **argv );
+/**
+ * @param input The path to expand
+ *
+ * Expand path, both `~` and `~<user>`
+ *
+ * @returns path
+ */
+char *rofi_expand_path ( const char *input );
#endif // ROFI_HELPER_H
diff --git a/include/rofi.h b/include/rofi.h
index f15e903b..b46f6ce1 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -339,13 +339,4 @@ struct _Mode
#define color_cyan_bold "\033[1;36m"
int show_error_message ( const char *msg, int markup );
-
-/**
- * @param input The path to expand
- *
- * Expand path, both `~` and `~<user>`
- *
- * @returns path
- */
-char *rofi_expand_path ( const char *input );
#endif
diff --git a/test/helper-test.c b/test/helper-test.c
index f5e2361d..91f5c143 100644
--- a/test/helper-test.c
+++ b/test/helper-test.c
@@ -49,17 +49,25 @@ int main ( int argc, char ** argv )
TASSERT ( strcmp ( list[4], "-c" ) == 0 );
TASSERT ( strcmp ( list[5], "ssh chuck; echo 'x-terminal-emulator chuck'" ) == 0 );
+ /**
+ * Test some path functions. Not easy as not sure what is right output on travis.
+ */
+ // Test if root is preserved.
char *str = rofi_expand_path("/");
TASSERT ( strcmp(str, "/") == 0 );
g_free(str);
+ // Test is relative path is preserved.
str = rofi_expand_path("../AUTHORS");
TASSERT ( strcmp(str, "../AUTHORS") == 0 );
g_free(str);
+ // Test another one.
str = rofi_expand_path("/bin/false");
TASSERT ( strcmp(str, "/bin/false") == 0 );
g_free(str);
+ // See if user paths get expanded in full path.
str = rofi_expand_path("~/");
- TASSERT ( str[0] == '/' );
+ const char *hd = g_get_home_dir();
+ TASSERT ( strcmp(str, hd) == 0);
g_free(str);
str = rofi_expand_path("~root/");
TASSERT ( str[0] == '/' );