1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add test, remove whitespace

This commit is contained in:
Dave Davenport 2015-12-08 08:39:18 +01:00
parent cb00fd2d68
commit 0ff0f15264
3 changed files with 25 additions and 11 deletions

View file

@ -99,7 +99,7 @@ README.html: README.md
${top_builddir}/config/config.c: ${top_srcdir}/config/config.def.c ${top_builddir}/config/config.c: ${top_srcdir}/config/config.def.c
cp ${top_srcdir}/config/config.def.c $@ cp ${top_srcdir}/config/config.def.c $@
## ##
# Extra DIST # Extra DIST
## ##
EXTRA_DIST=\ EXTRA_DIST=\
@ -158,13 +158,13 @@ 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
.PHONY: test-x .PHONY: test-x
test-x: ${bin_PROGRAMS} test-x: ${bin_PROGRAMS}
echo "Test 1" echo "Test 1"
$(top_srcdir)/test/run_test.sh 123 $(top_builddir)/textbox_test $(top_builddir) $(top_srcdir)/test/run_test.sh 123 $(top_builddir)/textbox_test $(top_builddir)
echo "Test 2" echo "Test 2"
$(top_srcdir)/test/run_test.sh 200 $(top_srcdir)/test/run_errormsg_test.sh $(top_builddir) $(top_srcdir)/test/run_test.sh 200 $(top_srcdir)/test/run_errormsg_test.sh $(top_builddir)
@ -179,7 +179,7 @@ test-x: ${bin_PROGRAMS}
echo "Test 7" echo "Test 7"
$(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir) $(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir)
echo "Issue 256" echo "Issue 256"
$(top_srcdir)/test/run_test.sh 206 $(top_srcdir)/test/run_issue_256.sh $(top_builddir) $(top_srcdir)/test/run_test.sh 206 $(top_srcdir)/test/run_issue_256.sh $(top_builddir)
echo "Issue 275" echo "Issue 275"
$(top_srcdir)/test/run_test.sh 207 $(top_srcdir)/test/run_issue_275.sh $(top_builddir) $(top_srcdir)/test/run_test.sh 207 $(top_srcdir)/test/run_issue_275.sh $(top_builddir)
echo "Crash empty list" echo "Crash empty list"
@ -201,4 +201,4 @@ cppcheck: ${rofi_SOURCES}
.PHONY: ohcount .PHONY: ohcount
ohcount: ${rofi_SOURCES} ohcount: ${rofi_SOURCES}
ohcount -i ${top_srcdir}/source/ ohcount -i ${top_srcdir}/source/

View file

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

View file

@ -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);
} }