diff options
-rw-r--r-- | SwifTools/Linkify.cpp | 2 | ||||
-rw-r--r-- | SwifTools/UnitTest/LinkifyTest.cpp | 9 |
2 files changed, 10 insertions, 1 deletions
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("<a href=\"http://bob:bla@swift.im/foo/bar\">http://bob:bla@swift.im/foo/bar</a>"), result); } + + void testLinkify_At() { + String result = Linkify::linkify("http://swift.im/foo@bar"); + + CPPUNIT_ASSERT_EQUAL( + String("<a href=\"http://swift.im/foo@bar\">http://swift.im/foo@bar</a>"), + result); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest); |