forked from innoq/statuses
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request innoq#158 from mvitz/157-fix-hashtag-with-caret
Fix innoq#157: caret in hashtag causes 500 error
- Loading branch information
Showing
3 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,60 +8,63 @@ | |
(deftest linkify-uris | ||
(is (= | ||
(linkify "lorem http://example.org ipsum") | ||
"lorem <a href='http://example.org'>http://example.org</a> ipsum")) | ||
"lorem <a href=\"http://example.org\">http://example.org</a> ipsum")) | ||
(is (= | ||
(linkify "http://example.org lipsum") | ||
"<a href='http://example.org'>http://example.org</a> lipsum")) | ||
"<a href=\"http://example.org\">http://example.org</a> lipsum")) | ||
(is (= | ||
(linkify "lipsum http://example.org") | ||
"lipsum <a href='http://example.org'>http://example.org</a>"))) | ||
"lipsum <a href=\"http://example.org\">http://example.org</a>"))) | ||
|
||
(deftest linkify-hashtags | ||
(is (= | ||
(linkify "lorem #hashtag ipsum") | ||
"lorem #<a href='/statuses/updates?query=%23hashtag'>hashtag</a> ipsum")) | ||
"lorem #<a href=\"/statuses/updates?query=%23hashtag\">hashtag</a> ipsum")) | ||
(is (= | ||
(linkify "#hashtag lipsum") | ||
"#<a href='/statuses/updates?query=%23hashtag'>hashtag</a> lipsum")) | ||
"#<a href=\"/statuses/updates?query=%23hashtag\">hashtag</a> lipsum")) | ||
(is (= | ||
(linkify "lipsum #hashtag") | ||
"lipsum #<a href='/statuses/updates?query=%23hashtag'>hashtag</a>"))) | ||
"lipsum #<a href=\"/statuses/updates?query=%23hashtag\">hashtag</a>")) | ||
(is (= | ||
(linkify "#WTF^2") | ||
"#<a href=\"/statuses/updates?query=%23WTF%5E2\">WTF^2</a>"))) | ||
|
||
(deftest linkify-uris-with-fragment-identifier | ||
(is (= | ||
(linkify "lorem http://example.org#anchor ipsum") | ||
"lorem <a href='http://example.org#anchor'>http://example.org#anchor</a> ipsum"))) | ||
"lorem <a href=\"http://example.org#anchor\">http://example.org#anchor</a> ipsum"))) | ||
(is (= | ||
(linkify "#hashtag lipsum http://example.org#anchor-name") | ||
"#<a href='/statuses/updates?query=%23hashtag'>hashtag</a> lipsum <a href='http://example.org#anchor-name'>http://example.org#anchor-name</a>")) | ||
"#<a href=\"/statuses/updates?query=%23hashtag\">hashtag</a> lipsum <a href=\"http://example.org#anchor-name\">http://example.org#anchor-name</a>")) | ||
(is (= | ||
(linkify "lipsum http://example.org#anchor-name #hashtag") | ||
"lipsum <a href='http://example.org#anchor-name'>http://example.org#anchor-name</a> #<a href='/statuses/updates?query=%23hashtag'>hashtag</a>")) | ||
"lipsum <a href=\"http://example.org#anchor-name\">http://example.org#anchor-name</a> #<a href=\"/statuses/updates?query=%23hashtag\">hashtag</a>")) | ||
|
||
(deftest linkify-email-addresses | ||
(is (= | ||
(linkify "hello [email protected] how are you") | ||
"hello <a href='mailto:[email protected]'>[email protected]</a> how are you"))) | ||
"hello <a href=\"mailto:[email protected]\">[email protected]</a> how are you"))) | ||
|
||
(deftest linkify-mentions | ||
(is (= | ||
(linkify "@foo") | ||
"@<a href='/statuses/updates?author=foo'>foo</a>")) | ||
"@<a href=\"/statuses/updates?author=foo\">foo</a>")) | ||
(is (= | ||
(linkify "@foo how are you") | ||
"@<a href='/statuses/updates?author=foo'>foo</a> how are you")) | ||
"@<a href=\"/statuses/updates?author=foo\">foo</a> how are you")) | ||
(is (= | ||
(linkify "how are you @foo") | ||
"how are you @<a href='/statuses/updates?author=foo'>foo</a>")) | ||
"how are you @<a href=\"/statuses/updates?author=foo\">foo</a>")) | ||
(is (= | ||
(linkify "nice to see @foo again") | ||
"nice to see @<a href='/statuses/updates?author=foo'>foo</a> again")) | ||
"nice to see @<a href=\"/statuses/updates?author=foo\">foo</a> again")) | ||
(is (= | ||
(linkify "@?") | ||
"@?")) | ||
(is (= | ||
(linkify "@foo: test") | ||
"@<a href='/statuses/updates?author=foo'>foo</a>: test")) | ||
"@<a href=\"/statuses/updates?author=foo\">foo</a>: test")) | ||
(is (= | ||
(linkify "@foo.bar test") | ||
"@<a href='/statuses/updates?author=foo'>foo</a>.bar test"))) | ||
"@<a href=\"/statuses/updates?author=foo\">foo</a>.bar test"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters