summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2015-12-08 08:39:18 +0100
committerDave Davenport <qball@gmpclient.org>2015-12-08 08:39:18 +0100
commit0ff0f152641ecbb0a5d28ce23e042cdb32c8ee04 (patch)
treeb60df4309f52666397c35309896d56d0e9d237c1
parentcb00fd2d685f3f15ece34da9151f1a393598f6af (diff)
Add test, remove whitespace
-rw-r--r--Makefile.am10
-rw-r--r--include/helper.h5
-rw-r--r--test/helper-test.c21
3 files changed, 25 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am
index 556b5e54..b52052c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,7 +99,7 @@ README.html: README.md
${top_builddir}/config/config.c: ${top_srcdir}/config/config.def.c
cp ${top_srcdir}/config/config.def.c $@
-##
+##
# Extra DIST
##
EXTRA_DIST=\
@@ -158,13 +158,13 @@ helper_test_SOURCES=\
test/helper-test.c
.PHONY: test
-test: ${bin_PROGRAMS}
+test: ${bin_PROGRAMS} ${noinst_PROGRAMS}
./rofi_test
./helper_test
.PHONY: test-x
test-x: ${bin_PROGRAMS}
- echo "Test 1"
+ echo "Test 1"
$(top_srcdir)/test/run_test.sh 123 $(top_builddir)/textbox_test $(top_builddir)
echo "Test 2"
$(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"
$(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir)
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"
$(top_srcdir)/test/run_test.sh 207 $(top_srcdir)/test/run_issue_275.sh $(top_builddir)
echo "Crash empty list"
@@ -201,4 +201,4 @@ cppcheck: ${rofi_SOURCES}
.PHONY: ohcount
ohcount: ${rofi_SOURCES}
- ohcount -i ${top_srcdir}/source/
+ ohcount -i ${top_srcdir}/source/
diff --git a/include/helper.h b/include/helper.h
index 7f3e1776..fa4c338f 100644
--- a/include/helper.h
+++ b/include/helper.h
@@ -14,11 +14,6 @@
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 case_sensitive Whether case is significant.
*
diff --git a/test/helper-test.c b/test/helper-test.c
index d30a4a53..7081e19b 100644
--- a/test/helper-test.c
+++ b/test/helper-test.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <locale.h>
#include <glib.h>
#include <stdio.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 )
{
cmd_set_arguments ( argc, argv );
+
+ if ( setlocale ( LC_ALL, "" ) == NULL ) {
+ fprintf ( stderr, "Failed to set locale.\n" );
+ return EXIT_FAILURE;
+ }
char **list = NULL;
int llength = 0;
char * test_str =
@@ -48,6 +54,7 @@ int main ( int argc, char ** argv )
TASSERT ( strcmp ( list[3], "bash" ) == 0 );
TASSERT ( strcmp ( list[4], "-c" ) == 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.
@@ -73,5 +80,17 @@ int main ( int argc, char ** argv )
TASSERT ( str[0] == '/' );
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);
}