diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-06-26 19:34:11 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-06-26 19:34:41 (GMT) |
commit | e2d9f9e47056a41d5e5a67ea3130ccdd860a06ed (patch) | |
tree | 75651c66869903c9a34d013d3553b123768c35a3 /Swift/Controllers/UnitTest | |
parent | 649fc1d12d7be943b5ab964b9dac0670797d9057 (diff) | |
download | swift-e2d9f9e47056a41d5e5a67ea3130ccdd860a06ed.zip swift-e2d9f9e47056a41d5e5a67ea3130ccdd860a06ed.tar.bz2 |
Use nicks in tab titles.
Diffstat (limited to 'Swift/Controllers/UnitTest')
-rw-r--r-- | Swift/Controllers/UnitTest/NickResolverTest.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/Swift/Controllers/UnitTest/NickResolverTest.cpp b/Swift/Controllers/UnitTest/NickResolverTest.cpp index 947d3d8..e3123f9 100644 --- a/Swift/Controllers/UnitTest/NickResolverTest.cpp +++ b/Swift/Controllers/UnitTest/NickResolverTest.cpp @@ -10,6 +10,7 @@ class NickResolverTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(NickResolverTest); CPPUNIT_TEST(testNoMatch); + CPPUNIT_TEST(testZeroLengthMatch); CPPUNIT_TEST(testMatch); CPPUNIT_TEST(testOverwrittenMatch); CPPUNIT_TEST(testRemovedMatch); @@ -23,37 +24,45 @@ class NickResolverTest : public CppUnit::TestFixture void testNoMatch() { boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster()); NickResolver resolver(xmppRoster); - JID testling("foo@bar/baz"); + JID testJID("foo@bar/baz"); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testling)); + CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testJID)); + } + + void testZeroLengthMatch() { + boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster()); + NickResolver resolver(xmppRoster); + JID testJID("foo@bar/baz"); + xmppRoster->addContact(testJID, "", groups_); + CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testJID)); } void testMatch() { boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster()); NickResolver resolver(xmppRoster); - JID testling("foo@bar/baz"); - xmppRoster->addContact(testling, "Test", groups_); + JID testJID("foo@bar/baz"); + xmppRoster->addContact(testJID, "Test", groups_); - CPPUNIT_ASSERT_EQUAL(String("Test"), resolver.jidToNick(testling)); + CPPUNIT_ASSERT_EQUAL(String("Test"), resolver.jidToNick(testJID)); } void testOverwrittenMatch() { boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster()); NickResolver resolver(xmppRoster); - JID testling("foo@bar/baz"); - xmppRoster->addContact(testling, "FailTest", groups_); - xmppRoster->addContact(testling, "Test", groups_); + JID testJID("foo@bar/baz"); + xmppRoster->addContact(testJID, "FailTest", groups_); + xmppRoster->addContact(testJID, "Test", groups_); - CPPUNIT_ASSERT_EQUAL(String("Test"), resolver.jidToNick(testling)); + CPPUNIT_ASSERT_EQUAL(String("Test"), resolver.jidToNick(testJID)); } void testRemovedMatch() { boost::shared_ptr<XMPPRoster> xmppRoster(new XMPPRoster()); NickResolver resolver(xmppRoster); - JID testling("foo@bar/baz"); - xmppRoster->addContact(testling, "FailTest", groups_); - xmppRoster->removeContact(testling); - CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testling)); + JID testJID("foo@bar/baz"); + xmppRoster->addContact(testJID, "FailTest", groups_); + xmppRoster->removeContact(testJID); + CPPUNIT_ASSERT_EQUAL(String("foo@bar"), resolver.jidToNick(testJID)); } }; |