diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-27 19:12:46 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-27 19:51:30 (GMT) |
commit | 5f6543647862b5ae1d5abdddd0612e6cf9f23c8f (patch) | |
tree | a46da0aae9787c52963e1df59123a9326a055d02 /SwifTools/UnitTest | |
parent | 6810a2896f27e7ee07aee847f5e8dbccd1f6ec89 (diff) | |
download | swift-contrib-5f6543647862b5ae1d5abdddd0612e6cf9f23c8f.zip swift-contrib-5f6543647862b5ae1d5abdddd0612e6cf9f23c8f.tar.bz2 |
Changed linkifcation algorithm.
Diffstat (limited to 'SwifTools/UnitTest')
-rw-r--r-- | SwifTools/UnitTest/LinkifyTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/SwifTools/UnitTest/LinkifyTest.cpp b/SwifTools/UnitTest/LinkifyTest.cpp index 1418957..9655b87 100644 --- a/SwifTools/UnitTest/LinkifyTest.cpp +++ b/SwifTools/UnitTest/LinkifyTest.cpp @@ -14,6 +14,7 @@ using namespace Swift; class LinkifyTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(LinkifyTest); CPPUNIT_TEST(testLinkify_URLWithResource); + CPPUNIT_TEST(testLinkify_HTTPSURLWithResource); CPPUNIT_TEST(testLinkify_URLWithEmptyResource); CPPUNIT_TEST(testLinkify_BareURL); CPPUNIT_TEST(testLinkify_URLSurroundedByWhitespace); @@ -26,6 +27,7 @@ class LinkifyTest : public CppUnit::TestFixture { CPPUNIT_TEST(testLinkify_Equal); CPPUNIT_TEST(testLinkify_Authentication); CPPUNIT_TEST(testLinkify_At); + CPPUNIT_TEST(testLinkify_Amps); CPPUNIT_TEST_SUITE_END(); public: @@ -37,6 +39,14 @@ class LinkifyTest : public CppUnit::TestFixture { result); } + void testLinkify_HTTPSURLWithResource() { + String result = Linkify::linkify("https://swift.im/blog"); + + CPPUNIT_ASSERT_EQUAL( + String("<a href=\"https://swift.im/blog\">https://swift.im/blog</a>"), + result); + } + void testLinkify_URLWithEmptyResource() { String result = Linkify::linkify("http://swift.im/"); @@ -133,6 +143,14 @@ class LinkifyTest : public CppUnit::TestFixture { String("<a href=\"http://swift.im/foo@bar\">http://swift.im/foo@bar</a>"), result); } + + void testLinkify_Amps() { + String result = Linkify::linkify("http://swift.im/foo&bar&baz"); + + CPPUNIT_ASSERT_EQUAL( + String("<a href=\"http://swift.im/foo&bar&baz\">http://swift.im/foo&bar&baz</a>"), + result); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest); |