summaryrefslogtreecommitdiffstats
path: root/test/helper-test.c
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 /test/helper-test.c
parentcb00fd2d685f3f15ece34da9151f1a393598f6af (diff)
Add test, remove whitespace
Diffstat (limited to 'test/helper-test.c')
-rw-r--r--test/helper-test.c21
1 files changed, 20 insertions, 1 deletions
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);
}