mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Add test, remove whitespace
This commit is contained in:
parent
cb00fd2d68
commit
0ff0f15264
3 changed files with 25 additions and 11 deletions
|
@ -158,7 +158,7 @@ helper_test_SOURCES=\
|
||||||
test/helper-test.c
|
test/helper-test.c
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ${bin_PROGRAMS}
|
test: ${bin_PROGRAMS} ${noinst_PROGRAMS}
|
||||||
./rofi_test
|
./rofi_test
|
||||||
./helper_test
|
./helper_test
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,6 @@
|
||||||
*/
|
*/
|
||||||
int helper_parse_setup ( char * string, char ***output, int *length, ... );
|
int helper_parse_setup ( char * string, char ***output, int *length, ... );
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of fgets with custom separator.
|
|
||||||
*/
|
|
||||||
char* fgets_s ( char* s, unsigned int n, FILE *iop, char sep );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param token The string for which we want a collation key.
|
* @param token The string for which we want a collation key.
|
||||||
* @param case_sensitive Whether case is significant.
|
* @param case_sensitive Whether case is significant.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <locale.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <helper.h>
|
#include <helper.h>
|
||||||
|
@ -34,6 +35,11 @@ int monitor_get_dimension ( G_GNUC_UNUSED Display *d, G_GNUC_UNUSED Screen *scre
|
||||||
int main ( int argc, char ** argv )
|
int main ( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
cmd_set_arguments ( argc, argv );
|
cmd_set_arguments ( argc, argv );
|
||||||
|
|
||||||
|
if ( setlocale ( LC_ALL, "" ) == NULL ) {
|
||||||
|
fprintf ( stderr, "Failed to set locale.\n" );
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
char **list = NULL;
|
char **list = NULL;
|
||||||
int llength = 0;
|
int llength = 0;
|
||||||
char * test_str =
|
char * test_str =
|
||||||
|
@ -48,6 +54,7 @@ int main ( int argc, char ** argv )
|
||||||
TASSERT ( strcmp ( list[3], "bash" ) == 0 );
|
TASSERT ( strcmp ( list[3], "bash" ) == 0 );
|
||||||
TASSERT ( strcmp ( list[4], "-c" ) == 0 );
|
TASSERT ( strcmp ( list[4], "-c" ) == 0 );
|
||||||
TASSERT ( strcmp ( list[5], "ssh chuck; echo 'x-terminal-emulator chuck'" ) == 0 );
|
TASSERT ( strcmp ( list[5], "ssh chuck; echo 'x-terminal-emulator chuck'" ) == 0 );
|
||||||
|
g_strfreev ( list );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test some path functions. Not easy as not sure what is right output on travis.
|
* Test some path functions. Not easy as not sure what is right output on travis.
|
||||||
|
@ -73,5 +80,17 @@ int main ( int argc, char ** argv )
|
||||||
TASSERT ( str[0] == '/' );
|
TASSERT ( str[0] == '/' );
|
||||||
g_free ( str );
|
g_free ( str );
|
||||||
|
|
||||||
g_strfreev ( list );
|
/**
|
||||||
|
* Collating.
|
||||||
|
*/
|
||||||
|
char *res = token_collate_key ( "€ Sign",FALSE);
|
||||||
|
TASSERT ( strcmp(res, "€ sign") == 0);
|
||||||
|
g_free(res);
|
||||||
|
|
||||||
|
res = token_collate_key ( "éÉêèë Sign",FALSE);
|
||||||
|
TASSERT ( strcmp(res, "ééêèë sign") == 0);
|
||||||
|
g_free(res);
|
||||||
|
res = token_collate_key ( "éÉêèë Sign",TRUE);
|
||||||
|
TASSERT ( strcmp(res, "éÉêèë Sign") == 0);
|
||||||
|
g_free(res);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue