diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-06-25 14:23:36 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-06-25 14:23:36 +0100 |
commit | 484ce52850f6600d52074110ccebb2640564438a (patch) | |
tree | 93eed7851e40a6b5dbb988c58afb6e3f378e4722 /tests | |
parent | f52003a111d3b82d8e63b0eef88e0507f5f39cba (diff) |
add test_set_attribute
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wocky-xmpp-node-test.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/wocky-xmpp-node-test.c b/tests/wocky-xmpp-node-test.c index c623874..8f8bcd7 100644 --- a/tests/wocky-xmpp-node-test.c +++ b/tests/wocky-xmpp-node-test.c @@ -31,6 +31,37 @@ test_node_equal (void) g_object_unref (b); } +static void +test_set_attribute (void) +{ + WockyXmppStanza *a, *b, *c; + + a = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_SET, + "juliet@example.com", "romeo@example.org", WOCKY_STANZA_END); + + b = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_SET, + "juliet@example.com", "romeo@example.org", + WOCKY_NODE_ATTRIBUTE, "foo", "badger", + WOCKY_STANZA_END); + + g_assert (!wocky_xmpp_node_equal (a->node, b->node)); + wocky_xmpp_node_set_attribute (a->node, "foo", "badger"); + g_assert (wocky_xmpp_node_equal (a->node, b->node)); + + c = wocky_xmpp_stanza_build (WOCKY_STANZA_TYPE_IQ, WOCKY_STANZA_SUB_TYPE_SET, + "juliet@example.com", "romeo@example.org", + WOCKY_NODE_ATTRIBUTE, "foo", "snake", + WOCKY_STANZA_END); + + g_assert (!wocky_xmpp_node_equal (b->node, c->node)); + wocky_xmpp_node_set_attribute (b->node, "foo", "snake"); + g_assert (wocky_xmpp_node_equal (b->node, c->node)); + + g_object_unref (a); + g_object_unref (b); + g_object_unref (c); +} + int main (int argc, char **argv) { @@ -40,5 +71,6 @@ main (int argc, char **argv) g_type_init (); g_test_add_func ("/xmpp-node/node-equal", test_node_equal); + g_test_add_func ("/xmpp-node/set-attribute", test_set_attribute); return g_test_run (); } |