diff options
author | Alban Crequy <alban.crequy@collabora.co.uk> | 2014-09-24 16:29:21 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-09-25 12:59:50 +0100 |
commit | d5ea45d73558cc5f7a38eb1d2805f52b31d89abc (patch) | |
tree | 6cf0c8e7e882a71726391e49cfdca4788281da0f /bus/signals.c | |
parent | 5d1f9cbdb927576df25128638400d656d9872dc6 (diff) | |
download | dbus-d5ea45d73558cc5f7a38eb1d2805f52b31d89abc.tar.gz |
match_rule_to_string: add test
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'bus/signals.c')
-rw-r--r-- | bus/signals.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/bus/signals.c b/bus/signals.c index a7e23776..b283c4d9 100644 --- a/bus/signals.c +++ b/bus/signals.c @@ -2499,7 +2499,12 @@ static struct { { "type='method_call',arg3='foosh'", "arg3='foosh',type='method_call'" }, { "arg3='fool'", "arg3='fool'" }, { "arg0namespace='fool'", "arg0namespace='fool'" }, - { "member='food'", "member='food'" } + { "member='food'", "member='food'" }, + { "member=escape", "member='escape'" }, + { "member=icecream", "member=ice'cream'" }, + { "arg0='comma,type=comma',type=signal", "type=signal,arg0='comma,type=comma'" }, + { "arg0=escap\\e", "arg0='escap\\e'" }, + { "arg0=Time: 8 o\\'clock", "arg0='Time: 8 o'\\''clock'" }, }; static void @@ -2512,6 +2517,8 @@ test_equality (void) { BusMatchRule *first; BusMatchRule *second; + char *first_str, *second_str; + BusMatchRule *first_reparsed, *second_reparsed; int j; first = check_parse (TRUE, equality_tests[i].first); @@ -2527,6 +2534,21 @@ test_equality (void) exit (1); } + /* Check match_rule_to_string */ + first_str = match_rule_to_string (first); + _dbus_assert (first_str != NULL); + second_str = match_rule_to_string (second); + _dbus_assert (second_str != NULL); + _dbus_assert (strcmp (first_str, second_str) == 0); + first_reparsed = check_parse (TRUE, first_str); + second_reparsed = check_parse (TRUE, second_str); + _dbus_assert (match_rule_equal (first, first_reparsed)); + _dbus_assert (match_rule_equal (second, second_reparsed)); + bus_match_rule_unref (first_reparsed); + bus_match_rule_unref (second_reparsed); + dbus_free (first_str); + dbus_free (second_str); + bus_match_rule_unref (second); /* Check that the rule is not equal to any of the |