summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-27 19:12:46 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-27 19:51:30 (GMT)
commit5f6543647862b5ae1d5abdddd0612e6cf9f23c8f (patch)
treea46da0aae9787c52963e1df59123a9326a055d02 /SwifTools/UnitTest
parent6810a2896f27e7ee07aee847f5e8dbccd1f6ec89 (diff)
downloadswift-contrib-5f6543647862b5ae1d5abdddd0612e6cf9f23c8f.zip
swift-contrib-5f6543647862b5ae1d5abdddd0612e6cf9f23c8f.tar.bz2
Changed linkifcation algorithm.
Diffstat (limited to 'SwifTools/UnitTest')
-rw-r--r--SwifTools/UnitTest/LinkifyTest.cpp18
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);