From 470057be17347568db8bd51f3a714431596f23aa Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 25 Apr 2017 23:34:48 +0200 Subject: [PATCH] Add some tests importing (and failing) file. --- test/theme-parser-test.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 7f5c0bf6..f97545e5 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -56,7 +56,7 @@ struct xcb_stuff *xcb; gboolean error = FALSE; void rofi_add_error_message ( GString *msg ) { - + fprintf ( stdout, "%s\n", msg->str ); error = TRUE; g_string_free ( msg, TRUE ); } @@ -175,6 +175,7 @@ int main ( int argc, char ** argv ) } { + rofi_theme = NULL; error = 0; rofi_theme_parse_string ( "* { test: 10px;}"); TASSERT ( error == 0 ); @@ -188,6 +189,7 @@ int main ( int argc, char ** argv ) rofi_theme = NULL; } { + rofi_theme = NULL; error = 0; rofi_theme_parse_string ( "* { test: 10%;}"); TASSERT ( error == 0 ); @@ -200,4 +202,28 @@ int main ( int argc, char ** argv ) rofi_theme_free ( rofi_theme ); rofi_theme = NULL; } + + { + rofi_theme = NULL; + rofi_theme_parse_file ("/dev/null"); + TASSERT ( error == 0 ); + TASSERT ( rofi_theme != NULL ); + rofi_theme_free ( rofi_theme ); + } + { + rofi_theme = NULL; + rofi_theme_parse_file ("not-existing-file.rasi"); + TASSERT ( error == TRUE ); + TASSERT ( rofi_theme == NULL ); + error = 0; + } + { + rofi_theme = NULL; + rofi_theme_parse_string ( "@import \"/dev/null\"" ); + TASSERT ( error == 0 ); + TASSERT ( rofi_theme != NULL ); + rofi_theme_free ( rofi_theme ); + + + } }