Fix func. def in wrong header file.

This commit is contained in:
Dave Davenport 2015-12-02 17:56:25 +01:00
parent 91e0f6b555
commit e4c7fe8f1e
3 changed files with 17 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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] == '/' );