From 2d3c5ce054a27548e72638c02c9bf3c8cec2faba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 24 Oct 2010 19:44:56 +0200 Subject: Linkify links with @ in them properly. diff --git a/SwifTools/Linkify.cpp b/SwifTools/Linkify.cpp index a122695..0ebe832 100644 --- a/SwifTools/Linkify.cpp +++ b/SwifTools/Linkify.cpp @@ -10,7 +10,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 afaac60..1418957 100644 --- a/SwifTools/UnitTest/LinkifyTest.cpp +++ b/SwifTools/UnitTest/LinkifyTest.cpp @@ -25,6 +25,7 @@ class LinkifyTest : public CppUnit::TestFixture { CPPUNIT_TEST(testLinkify_Tilde); CPPUNIT_TEST(testLinkify_Equal); CPPUNIT_TEST(testLinkify_Authentication); + CPPUNIT_TEST(testLinkify_At); CPPUNIT_TEST_SUITE_END(); public: @@ -124,6 +125,14 @@ class LinkifyTest : public CppUnit::TestFixture { String("http://bob:bla@swift.im/foo/bar"), result); } + + void testLinkify_At() { + String result = Linkify::linkify("http://swift.im/foo@bar"); + + CPPUNIT_ASSERT_EQUAL( + String("http://swift.im/foo@bar"), + result); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest); -- cgit v0.10.2-6-g49f6