diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-10 18:49:21 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-10 18:49:21 (GMT) |
commit | 61f24ccd90d2b7c48b2d5091c11964f455e8e9a8 (patch) | |
tree | 7b4a3c98b00800bc6870723a09ab7844ab66bf8d /SwifTools/UnitTest | |
parent | 5ddef4042f9049e3f436b21b7b1d6d50789c5a1e (diff) | |
download | swift-contrib-61f24ccd90d2b7c48b2d5091c11964f455e8e9a8.zip swift-contrib-61f24ccd90d2b7c48b2d5091c11964f455e8e9a8.tar.bz2 |
Fixed linkification of URLs followed by newlines.
Resolves: #762
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 60edc9b..a35a686 100644 --- a/SwifTools/UnitTest/LinkifyTest.cpp +++ b/SwifTools/UnitTest/LinkifyTest.cpp @@ -29,6 +29,8 @@ class LinkifyTest : public CppUnit::TestFixture { CPPUNIT_TEST(testLinkify_At); CPPUNIT_TEST(testLinkify_Amps); CPPUNIT_TEST(testLinkify_UnicodeCharacter); + CPPUNIT_TEST(testLinkify_NewLine); + CPPUNIT_TEST(testLinkify_Tab); CPPUNIT_TEST_SUITE_END(); public: @@ -160,6 +162,22 @@ class LinkifyTest : public CppUnit::TestFixture { String("<a href=\"http://\xe2\x98\x83.net\">http://\xe2\x98\x83.net</a>"), result); } + + void testLinkify_NewLine() { + String result = Linkify::linkify("http://swift.im\nfoo"); + + CPPUNIT_ASSERT_EQUAL( + String("<a href=\"http://swift.im\">http://swift.im</a>\nfoo"), + result); + } + + void testLinkify_Tab() { + String result = Linkify::linkify("http://swift.im\tfoo"); + + CPPUNIT_ASSERT_EQUAL( + String("<a href=\"http://swift.im\">http://swift.im</a>\tfoo"), + result); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest); |