From b793111e4e4bbbe6738e4d0838e9a99b3580549d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Mon, 16 Nov 2009 19:20:52 +0100 Subject: Fixed Linkify on camel case URLs. diff --git a/SwifTools/Linkify.cpp b/SwifTools/Linkify.cpp index 8654307..8cc169b 100644 --- a/SwifTools/Linkify.cpp +++ b/SwifTools/Linkify.cpp @@ -4,7 +4,7 @@ namespace Swift { -static const boost::regex linkifyRegexp("(https?://([-\\w\\.]+)+(:\\d+)?(/([%-\\w/_\\.]*(\\?\\S+)?)?)?)"); +static const boost::regex linkifyRegexp("(https?://([\\-\\w\\.]+)+(:\\d+)?(/([%\\-\\w/_\\.]*(\\?\\S+)?)?)?)"); String Linkify::linkify(const String& input) { return String(boost::regex_replace( diff --git a/SwifTools/UnitTest/LinkifyTest.cpp b/SwifTools/UnitTest/LinkifyTest.cpp index 9b66614..a249d48 100644 --- a/SwifTools/UnitTest/LinkifyTest.cpp +++ b/SwifTools/UnitTest/LinkifyTest.cpp @@ -12,6 +12,7 @@ class LinkifyTest : public CppUnit::TestFixture { CPPUNIT_TEST(testLinkify_BareURL); CPPUNIT_TEST(testLinkify_URLSurroundedByWhitespace); CPPUNIT_TEST(testLinkify_MultipleURLs); + CPPUNIT_TEST(testLinkify_CamelCase); CPPUNIT_TEST_SUITE_END(); public: @@ -55,6 +56,14 @@ class LinkifyTest : public CppUnit::TestFixture { String("Foo http://swift.im/blog Bar http://el-tramo.be/about Baz"), result); } + + void testLinkify_CamelCase() { + String result = Linkify::linkify("http://fOo.cOm/bAz"); + + CPPUNIT_ASSERT_EQUAL( + String("http://fOo.cOm/bAz"), + result); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest); -- cgit v0.10.2-6-g49f6