From b9c624d2eef609b2cd3456828b3f0858477b1fbf Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 26 Jun 2017 23:00:41 +0200 Subject: Add test for strings with embedded "'s --- test/theme-parser-test.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 77148ab6..b14b358a 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -1024,6 +1024,21 @@ START_TEST ( test_properties_padding_4 ) } END_TEST +START_TEST ( test_properties_string_escape ) +{ + widget wid; + wid.name = "blaat"; + wid.state = NULL; + rofi_theme_parse_string ( "* { font: \"aap\" noot\" mies \";\ntest: \"'123.432'\"; }"); + + const char *str= rofi_theme_get_string ( &wid, "font", NULL ); + ck_assert_ptr_nonnull ( str ); + ck_assert_int_eq ( g_utf8_collate ( str, "aap\" noot\" mies " ) , 0 ); + const char *str2= rofi_theme_get_string ( &wid, "test", NULL ); + ck_assert_ptr_nonnull ( str2 ); + ck_assert_int_eq ( g_utf8_collate ( str2, "'123.432'" ) , 0 ); +} +END_TEST START_TEST ( test_properties_string ) { widget wid; @@ -1308,6 +1323,7 @@ static Suite * theme_parser_suite (void) TCase *tc_prop_string = tcase_create("PropertiesString"); tcase_add_checked_fixture(tc_prop_string, theme_parser_setup, theme_parser_teardown); tcase_add_test ( tc_prop_string, test_properties_string); + tcase_add_test ( tc_prop_string, test_properties_string_escape); suite_add_tcase(s, tc_prop_string ); } -- cgit v1.2.3