Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove non-url specific tests

  • Loading branch information...
commit 2412255ca574dd220c86d17e25317f347c747500 1 parent a405a8d
@endform endform authored
Showing with 0 additions and 1,399 deletions.
  1. +0 −748 autolink.yml
  2. +0 −484 extract.yml
  3. +0 −71 hit_highlighting.yml
  4. +0 −96 validate.yml
View
748 autolink.yml
@@ -1,749 +1 @@
tests:
- usernames:
- - description: "Autolink trailing username"
- text: "text @username"
- expected: "text @<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>"
-
- - description: "Autolink username at the beginning"
- text: "@username text"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a> text"
-
- - description: "DO NOT Autolink username preceded by a letter"
- text: "meet@the beach"
- expected: "meet@the beach"
-
- - description: "Autolink username preceded by puctuation"
- text: "great.@username"
- expected: "great.@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>"
-
- - description: "Autolink username followed by puctuation"
- text: "@username&^$%^"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>&^$%^"
-
- - description: "Autolink username followed by Japanese"
- text: "@usernameの"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>の"
-
- - description: "Autolink username preceded by Japanese"
- text: "あ@username"
- expected: "あ@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>"
-
- - description: "Autolink username surrounded by Japanese"
- text: "あ@usernameの"
- expected: "あ@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>の"
-
- - description: "Autolink username in compressed RT"
- text: "RT@username: long Tweet is loooong"
- expected: "RT@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>: long Tweet is loooong"
-
- - description: "DO NOT Autolink username followed by accented latin characters"
- text: "@aliceìnheiro something something"
- expected: "@aliceìnheiro something something"
-
- - description: "DO NOT Autolink username @_ in @_@"
- text: "oh, snap! @_@"
- expected: "oh, snap! @_@"
-
- - description: "Autolink username with full-width at sign (U+FF20)"
- text: "@username"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>"
-
- - description: "DO NOT Autolink username over 20 characters"
- text: "@username9012345678901"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/username901234567890\">username901234567890</a>1"
-
- - description: "Autolink two usernames"
- text: "@foo @bar"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/foo\">foo</a> @<a class=\"tweet-url username\" href=\"https://twitter.com/bar\">bar</a>"
-
- - description: "Autolink usernames followed by :"
- text: "@foo: @bar"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/foo\">foo</a>: @<a class=\"tweet-url username\" href=\"https://twitter.com/bar\">bar</a>"
-
- - description: "Autolink usernames that are followed by international characters"
- text: "@foo îs in the house"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/foo\">foo</a> îs in the house"
-
- lists:
- - description: "Autolink list preceded by a space"
- text: "text @username/list"
- expected: "text @<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list\">username/list</a>"
-
- - description: "DO NOT Autolink list when space follows slash"
- text: "text @username/ list"
- expected: "text @<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>/ list"
-
- - description: "DO NOT Autolink list with empty username"
- text: "text @/list"
- expected: "text @/list"
-
- - description: "Autolink list at the beginning"
- text: "@username/list"
- expected: "@<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list\">username/list</a>"
-
- - description: "DO NOT Autolink list preceded by letter"
- text: "meet@the/beach"
- expected: "meet@the/beach"
-
- - description: "Autolink list preceded by puctuation"
- text: "great.@username/list"
- expected: "great.@<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list\">username/list</a>"
-
- - description: "Autolink list followed by puctuation"
- text: "@username/list&^$%^"
- expected: "@<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list\">username/list</a>&^$%^"
-
- - description: "Autolink list name over 25 characters (truncated to 25)"
- text: "@username/list567890123456789012345A"
- expected: "@<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list567890123456789012345\">username/list567890123456789012345</a>A"
-
- - description: "Autolink list that contains an _"
- text: "text @username/list_name"
- expected: "text @<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list_name\">username/list_name</a>"
-
- - description: "Autolink list that contains a -"
- text: "text @username/list-name"
- expected: "text @<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list-name\">username/list-name</a>"
-
- - description: "Autolink list that contains a number"
- text: "text @username/list123"
- expected: "text @<a class=\"tweet-url list-slug\" href=\"https://twitter.com/username/list123\">username/list123</a>"
-
- - description: "DO NOT Autolink list starting with a number"
- text: "@username/1list"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>/1list"
-
- hashtags:
- - description: "Autolink trailing hashtag"
- text: "text #hashtag"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>"
-
- - description: "Autolink alphanumeric hashtag (letter-number-letter)"
- text: "text #hash0tag"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hash0tag\" title=\"#hash0tag\" class=\"tweet-url hashtag\">#hash0tag</a>"
-
- - description: "Autolink alphanumeric hashtag (number-letter)"
- text: "text #1tag"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%231tag\" title=\"#1tag\" class=\"tweet-url hashtag\">#1tag</a>"
-
- - description: "Autolink hashtag with underscore"
- text: "text #hash_tag"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hash_tag\" title=\"#hash_tag\" class=\"tweet-url hashtag\">#hash_tag</a>"
-
- - description: "DO NOT Autolink all-numeric hashtags"
- text: "text #1234"
- expected: "text #1234"
-
- - description: "DO NOT Autolink hashtag preceded by a letter"
- text: "text#hashtag"
- expected: "text#hashtag"
-
- - description: "Autolink multiple hashtags"
- text: "text #hashtag1 #hashtag2"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hashtag1\" title=\"#hashtag1\" class=\"tweet-url hashtag\">#hashtag1</a> <a href=\"https://twitter.com/#!/search?q=%23hashtag2\" title=\"#hashtag2\" class=\"tweet-url hashtag\">#hashtag2</a>"
-
- - description: "Autolink hashtag preceded by a period"
- text: "text.#hashtag"
- expected: "text.<a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>"
-
- - description: "DO NOT Autolink hashtag preceded by &"
- text: "&#nbsp;"
- expected: "&#nbsp;"
-
- - description: "Autolink hashtag followed by ! (! not included)"
- text: "text #hashtag!"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>!"
-
- - description: "Autolink two hashtags separated by a slash"
- text: "text #dodge/#answer"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23dodge\" title=\"#dodge\" class=\"tweet-url hashtag\">#dodge</a>/<a href=\"https://twitter.com/#!/search?q=%23answer\" title=\"#answer\" class=\"tweet-url hashtag\">#answer</a>"
-
- - description: "Autolink hashtag before a slash"
- text: "text #dodge/answer"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23dodge\" title=\"#dodge\" class=\"tweet-url hashtag\">#dodge</a>/answer"
-
- - description: "Autolink hashtag after a slash"
- text: "text dodge/#answer"
- expected: "text dodge/<a href=\"https://twitter.com/#!/search?q=%23answer\" title=\"#answer\" class=\"tweet-url hashtag\">#answer</a>"
-
- - description: "Autolink hashtag followed by Japanese"
- text: "text #hashtagの"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hashtagの\" title=\"#hashtagの\" class=\"tweet-url hashtag\">#hashtagの</a>"
-
- - description: "Autolink hashtag preceded by full-width space (U+3000)"
- text: "text #hashtag"
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>"
-
- - description: "Autolink hashtag followed by full-width space (U+3000)"
- text: "#hashtag text"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a> text"
-
- - description: "Autolink hashtag with full-width hash (U+FF03)"
- text: "#hashtag"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>"
-
- - description: "Autolink hashtag with accented character at the start"
- text: "#éhashtag"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23éhashtag\" title=\"#éhashtag\" class=\"tweet-url hashtag\">#éhashtag</a>"
-
- - description: "Autolink hashtag with accented character at the end"
- text: "#hashtagé"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23hashtagé\" title=\"#hashtagé\" class=\"tweet-url hashtag\">#hashtagé</a>"
-
- - description: "Autolink hashtag with accented character in the middle"
- text: "#hashétag"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23hashétag\" title=\"#hashétag\" class=\"tweet-url hashtag\">#hashétag</a>"
-
- - description: "Autolink hashtags in Korean"
- text: "What is #트위터 anyway?"
- expected: "What is <a href=\"https://twitter.com/#!/search?q=%23트위터\" title=\"#트위터\" class=\"tweet-url hashtag\">#트위터</a> anyway?"
-
- - description: "Autolink hashtags in Russian"
- text: "What is #ашок anyway?"
- expected: "What is <a href=\"https://twitter.com/#!/search?q=%23ашок\" title=\"#ашок\" class=\"tweet-url hashtag\">#ашок</a> anyway?"
-
- - description: "Autolink a katakana hashtag preceded by a space and followed by a space"
- text: "カタカナ #カタカナ カタカナ"
- expected: "カタカナ <a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a> カタカナ"
-
- - description: "Autolink a katakana hashtag preceded by a space and followed by a bracket"
- text: "カタカナ #カタカナ」カタカナ"
- expected: "カタカナ <a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a>」カタカナ"
-
- - description: "Autolink a katakana hashtag preceded by a space and followed by a edge"
- text: "カタカナ #カタカナ"
- expected: "カタカナ <a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a>"
-
- - description: "Autolink a katakana hashtag preceded by a bracket and followed by a space"
- text: "カタカナ「#カタカナ カタカナ"
- expected: "カタカナ「<a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a> カタカナ"
-
- - description: "Autolink a katakana hashtag preceded by a bracket and followed by a bracket"
- text: "カタカナ「#カタカナ」カタカナ"
- expected: "カタカナ「<a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a>」カタカナ"
-
- - description: "Autolink a katakana hashtag preceded by a bracket and followed by a edge"
- text: "カタカナ「#カタカナ"
- expected: "カタカナ「<a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a>"
-
- - description: "Autolink a katakana hashtag preceded by a edge and followed by a space"
- text: "#カタカナ カタカナ"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a> カタカナ"
-
- - description: "Autolink a katakana hashtag preceded by a edge and followed by a bracket"
- text: "#カタカナ」カタカナ"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a>」カタカナ"
-
- - description: "Autolink a katakana hashtag preceded by a edge and followed by a edge"
- text: "#カタカナ"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23カタカナ\" title=\"#カタカナ\" class=\"tweet-url hashtag\">#カタカナ</a>"
-
- - description: "Autolink a katakana hashtag with a voiced sounds mark followed by a space"
- text: "#ハッシュタグ テスト"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23ハッシュタグ\" title=\"#ハッシュタグ\" class=\"tweet-url hashtag\">#ハッシュタグ</a> テスト"
-
- - description: "Autolink a katakana hashtag with a voiced sounds mark followed by numbers"
- text: "#ハッシュタグ123"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23ハッシュタグ123\" title=\"#ハッシュタグ123\" class=\"tweet-url hashtag\">#ハッシュタグ123</a>"
-
- - description: "Autolink a katakana hashtag with another voiced sounds mark"
- text: "#パピプペポ"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23パピプペポ\" title=\"#パピプペポ\" class=\"tweet-url hashtag\">#パピプペポ</a>"
-
- - description: "Autolink a kanji hashtag preceded by a space and followed by a space"
- text: "漢字 #漢字 漢字"
- expected: "漢字 <a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a> 漢字"
-
- - description: "Autolink a kanji hashtag preceded by a space and followed by a bracket"
- text: "漢字 #漢字」漢字"
- expected: "漢字 <a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a>」漢字"
-
- - description: "Autolink a kanji hashtag preceded by a space and followed by a edge"
- text: "漢字 #漢字"
- expected: "漢字 <a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a>"
-
- - description: "Autolink a kanji hashtag preceded by a bracket and followed by a space"
- text: "漢字「#漢字 漢字"
- expected: "漢字「<a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a> 漢字"
-
- - description: "Autolink a kanji hashtag preceded by a bracket and followed by a bracket"
- text: "漢字「#漢字」漢字"
- expected: "漢字「<a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a>」漢字"
-
- - description: "Autolink a kanji hashtag preceded by a bracket and followed by a edge"
- text: "漢字「#漢字"
- expected: "漢字「<a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a>"
-
- - description: "Autolink a kanji hashtag preceded by a edge and followed by a space"
- text: "#漢字 漢字"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a> 漢字"
-
- - description: "Autolink a kanji hashtag preceded by a edge and followed by a bracket"
- text: "#漢字」漢字"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a>」漢字"
-
- - description: "Autolink a kanji hashtag preceded by a edge and followed by a edge"
- text: "#漢字"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23漢字\" title=\"#漢字\" class=\"tweet-url hashtag\">#漢字</a>"
-
- - description: "Autolink a kanji hashtag preceded by an ideographic comma, followed by an ideographic period"
- text: "これは、#大丈夫。"
- expected: "これは、<a href=\"https://twitter.com/#!/search?q=%23大丈夫\" title=\"#大丈夫\" class=\"tweet-url hashtag\">#大丈夫</a>。"
-
- - description: "Autolink a hiragana hashtag preceded by a space and followed by a space"
- text: "ひらがな #ひらがな ひらがな"
- expected: "ひらがな <a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a> ひらがな"
-
- - description: "Autolink a hiragana hashtag preceded by a space and followed by a bracket"
- text: "ひらがな #ひらがな」ひらがな"
- expected: "ひらがな <a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a>」ひらがな"
-
- - description: "Autolink a hiragana hashtag preceded by a space and followed by a edge"
- text: "ひらがな #ひらがな"
- expected: "ひらがな <a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a>"
-
- - description: "Autolink a hiragana hashtag preceded by a bracket and followed by a space"
- text: "ひらがな「#ひらがな ひらがな"
- expected: "ひらがな「<a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a> ひらがな"
-
- - description: "Autolink a hiragana hashtag preceded by a bracket and followed by a bracket"
- text: "ひらがな「#ひらがな」ひらがな"
- expected: "ひらがな「<a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a>」ひらがな"
-
- - description: "Autolink a hiragana hashtag preceded by a bracket and followed by a edge"
- text: "ひらがな「#ひらがな"
- expected: "ひらがな「<a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a>"
-
- - description: "Autolink a hiragana hashtag preceded by a edge and followed by a space"
- text: "#ひらがな ひらがな"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a> ひらがな"
-
- - description: "Autolink a hiragana hashtag preceded by a edge and followed by a bracket"
- text: "#ひらがな」ひらがな"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a>」ひらがな"
-
- - description: "Autolink a hiragana hashtag preceded by a edge and followed by a edge"
- text: "#ひらがな"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23ひらがな\" title=\"#ひらがな\" class=\"tweet-url hashtag\">#ひらがな</a>"
-
- - description: "Autolink a Kanji/Katakana mix hashtag"
- text: "日本語ハッシュタグ #日本語ハッシュタグ"
- expected: "日本語ハッシュタグ <a href=\"https://twitter.com/#!/search?q=%23日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"tweet-url hashtag\">#日本語ハッシュタグ</a>"
-
- - description: "DO NOT autolink a hashtag without a preceding space"
- text: "日本語ハッシュタグ#日本語ハッシュタグ"
- expected: "日本語ハッシュタグ#日本語ハッシュタグ"
-
- - description: "DO NOT include a punctuation in a hashtag"
- text: "#日本語ハッシュタグ。"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"tweet-url hashtag\">#日本語ハッシュタグ</a>。"
-
- - description: "Autolink a hashtag after a punctuation"
- text: "日本語ハッシュタグ。#日本語ハッシュタグ"
- expected: "日本語ハッシュタグ。<a href=\"https://twitter.com/#!/search?q=%23日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"tweet-url hashtag\">#日本語ハッシュタグ</a>"
-
- - description: "Autolink a hashtag with chouon"
- text: "長音ハッシュタグ。#サッカー"
- expected: "長音ハッシュタグ。<a href=\"https://twitter.com/#!/search?q=%23サッカー\" title=\"#サッカー\" class=\"tweet-url hashtag\">#サッカー</a>"
-
- - description: "Autolink a hashtag with half-width chouon"
- text: "長音ハッシュタグ。#サッカー"
- expected: "長音ハッシュタグ。<a href=\"https://twitter.com/#!/search?q=%23サッカー\" title=\"#サッカー\" class=\"tweet-url hashtag\">#サッカー</a>"
-
- - description: "Autolink a hashtag with half-width # after full-width !"
- text: "できましたよー!#日本語ハッシュタグ。"
- expected: "できましたよー!<a href=\"https://twitter.com/#!/search?q=%23日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"tweet-url hashtag\">#日本語ハッシュタグ</a>。"
-
- - description: "Autolink a hashtag with full-width # after full-width !"
- text: "できましたよー!#日本語ハッシュタグ。"
- expected: "できましたよー!<a href=\"https://twitter.com/#!/search?q=%23日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"tweet-url hashtag\">#日本語ハッシュタグ</a>。"
-
- - description: "Autolink a hashtag containing ideographic iteration mark"
- text: "#云々"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23云々\" title=\"#云々\" class=\"tweet-url hashtag\">#云々</a>"
-
- - description: "Autolink multiple hashtags in multiple languages"
- text: "Hashtags in #中文, #日本語, #한국말, and #русский! Try it out!"
- expected: "Hashtags in <a href=\"https://twitter.com/#!/search?q=%23中文\" title=\"#中文\" class=\"tweet-url hashtag\">#中文</a>, <a href=\"https://twitter.com/#!/search?q=%23日本語\" title=\"#日本語\" class=\"tweet-url hashtag\">#日本語</a>, <a href=\"https://twitter.com/#!/search?q=%23한국말\" title=\"#한국말\" class=\"tweet-url hashtag\">#한국말</a>, and <a href=\"https://twitter.com/#!/search?q=%23русский\" title=\"#русский\" class=\"tweet-url hashtag\">#русский</a>! Try it out!"
-
- - description: "Autolink should allow for ş (U+015F) in a hashtag"
- text: "Here’s a test tweet for you: #Ateş #qrşt #ştu #ş"
- expected: "Here’s a test tweet for you: <a href=\"https://twitter.com/#!/search?q=%23Ateş\" title=\"#Ateş\" class=\"tweet-url hashtag\">#Ateş</a> <a href=\"https://twitter.com/#!/search?q=%23qrşt\" title=\"#qrşt\" class=\"tweet-url hashtag\">#qrşt</a> <a href=\"https://twitter.com/#!/search?q=%23ştu\" title=\"#ştu\" class=\"tweet-url hashtag\">#ştu</a> <a href=\"https://twitter.com/#!/search?q=%23ş\" title=\"\" class=\"tweet-url hashtag\">#ş</a>"
-
- - description: "Autolink a hashtag with Latin extended character"
- text: "#mûǁae"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23mûǁae\" title=\"#mûǁae\" class=\"tweet-url hashtag\">#mûǁae</a>"
-
-# Please be careful with changes to this test case - what looks like "á" is really a + U+0301, and many editors will silently convert this to U+00E1.
- - description: "Autolink hashtags with combining diacritics"
- text: "#táim #hag̃ua"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23táim\" title=\"#táim\" class=\"tweet-url hashtag\">#táim</a> <a href=\"https://twitter.com/#!/search?q=%23hag̃ua\" title=\"#hag̃ua\" class=\"tweet-url hashtag\">#hag̃ua</a>"
-
- - description: "Autolink Arabic hashtag"
- text: "Arabic hashtag: #فارسی #لس_آنجلس"
- expected: "Arabic hashtag: <a href=\"https://twitter.com/#!/search?q=%23فارسی\" title=\"#فارسی\" class=\"tweet-url hashtag\">#فارسی</a> <a href=\"https://twitter.com/#!/search?q=%23لس_آنجلس\" title=\"#لس_آنجلس\" class=\"tweet-url hashtag\">#لس_آنجلس</a>"
-
- - description: "Autolink Thai hashtag"
- text: "Thai hashtag: #รายละเอียด"
- expected: "Thai hashtag: <a href=\"https://twitter.com/#!/search?q=%23รายละเอียด\" title=\"#รายละเอียด\" class=\"tweet-url hashtag\">#รายละเอียด</a>"
-
- urls:
- - description: "Autolink URL with pipe character"
- text: "text http://example.com/pipe|character?yes|pipe|character"
- expected: "text <a href=\"http://example.com/pipe|character?yes|pipe|character\">http://example.com/pipe|character?yes|pipe|character</a>"
-
- - description: "Autolink trailing url"
- text: "text http://example.com"
- expected: "text <a href=\"http://example.com\">http://example.com</a>"
-
- - description: "Autolink url in mid-text"
- text: "text http://example.com more text"
- expected: "text <a href=\"http://example.com\">http://example.com</a> more text"
-
- - description: "Autolink url in Japanese text"
- text: "いまなにしてるhttp://example.comいまなにしてる"
- expected: "いまなにしてる<a href=\"http://example.com\">http://example.com</a>いまなにしてる"
-
- - description: "Autolink url surrounded by parentheses does not capture them"
- text: "text (http://example.com)"
- expected: "text (<a href=\"http://example.com\">http://example.com</a>)"
-
- - description: "Autolink url with path surrounded by parentheses does not capture them"
- text: "text (http://example.com/test)"
- expected: "text (<a href=\"http://example.com/test\">http://example.com/test</a>)"
-
- - description: "Autolink url with embedded parentheses"
- text: "text http://msdn.com/S(deadbeef)/page.htm"
- expected: "text <a href=\"http://msdn.com/S(deadbeef)/page.htm\">http://msdn.com/S(deadbeef)/page.htm</a>"
-
- - description: "Extract valid URL: http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx"
- text: "text http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx"
- expected: "text <a href=\"http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx\">http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx</a>"
-
- - description: "Autolink url with balanced parens hiding XSS"
- text: 'text http://foo.com/("onclick="alert(1)")'
- expected: 'text <a href="http://foo.com/">http://foo.com/</a>("onclick="alert(1)")'
-
- - description: "Autolink url should NOT capture unbalanced parens"
- text: "Parenthetically bad http://example.com/i_has_a_) thing"
- expected: "Parenthetically bad <a href=\"http://example.com/i_has_a_\">http://example.com/i_has_a_</a>) thing"
-
- - description: "Autolink url containing unicode characters"
- text: "I enjoy Macintosh Brand computers: http://✪df.ws/ejp"
- expected: "I enjoy Macintosh Brand computers: <a href=\"http://✪df.ws/ejp\">http://✪df.ws/ejp</a>"
-
- - description: "Autolink url with .co. under TLD"
- text: "test http://www.example.co.jp"
- expected: "test <a href=\"http://www.example.co.jp\">http://www.example.co.jp</a>"
-
- - description: "DO NOT Autolink url containing ! character in the domain"
- text: "badly formatted http://foo!bar.com"
- expected: "badly formatted http://foo!bar.com"
-
- - description: "DO NOT Autolink url containing _ character in the domain"
- text: "badly formatted http://foo_bar.com"
- expected: "badly formatted http://foo_bar.com"
-
- - description: "Autolink url preceded by :"
- text: "text:http://example.com"
- expected: "text:<a href=\"http://example.com\">http://example.com</a>"
-
- - description: "Autolink url followed by ? (without it)"
- text: "text http://example.com?"
- expected: "text <a href=\"http://example.com\">http://example.com</a>?"
-
- - description: "Autolink url followed by ! (without it)"
- text: "text http://example.com!"
- expected: "text <a href=\"http://example.com\">http://example.com</a>!"
-
- - description: "Autolink url followed by , (without it)"
- text: "text http://example.com,"
- expected: "text <a href=\"http://example.com\">http://example.com</a>,"
-
- - description: "Autolink url with path followed by a comma (wihout the comma)"
- text: "In http://example.com/test, Douglas explains 42."
- expected: "In <a href=\"http://example.com/test\">http://example.com/test</a>, Douglas explains 42."
-
- - description: "Autolink url followed by . (without it)"
- text: "text http://example.com."
- expected: "text <a href=\"http://example.com\">http://example.com</a>."
-
- - description: "Autolink url followed by : (without it)"
- text: "text http://example.com:"
- expected: "text <a href=\"http://example.com\">http://example.com</a>:"
-
- - description: "Autolink url followed by ; (without it)"
- text: "text http://example.com;"
- expected: "text <a href=\"http://example.com\">http://example.com</a>;"
-
- - description: "Autolink url followed by ] (without it)"
- text: "text http://example.com]"
- expected: "text <a href=\"http://example.com\">http://example.com</a>]"
-
- - description: "Autolink url followed by ) (without it)"
- text: "text http://example.com)"
- expected: "text <a href=\"http://example.com\">http://example.com</a>)"
-
- - description: "Autolink url followed by } (without it)"
- text: "text http://example.com}"
- expected: "text <a href=\"http://example.com\">http://example.com</a>}"
-
- - description: "Autolink url followed by = (without it)"
- text: "text http://example.com="
- expected: "text <a href=\"http://example.com\">http://example.com</a>="
-
- - description: "Autolink url followed by ' (without it)"
- text: "text http://example.com'"
- expected: "text <a href=\"http://example.com\">http://example.com</a>'"
-
- - description: "Autolink url preceded by /"
- text: "text /http://example.com"
- expected: "text /<a href=\"http://example.com\">http://example.com</a>"
-
- - description: "Autolink url preceded by !"
- text: "text !http://example.com"
- expected: "text !<a href=\"http://example.com\">http://example.com</a>"
-
- - description: "DO NOT Autolink url preceded by ="
- text: "text =http://example.com"
- expected: "text =<a href=\"http://example.com\">http://example.com</a>"
-
- - description: "Autolink url surrounded by double quotes"
- text: "text \"http://example.com\""
- expected: "text \"<a href=\"http://example.com\">http://example.com</a>\""
-
- - description: "DO NOT Autolink url preceded by @"
- text: "@http://example.com"
- expected: "@http://example.com"
-
- - description: "DO NOT Autolink domain in email address"
- text: "foo@bar.com"
- expected: "foo@bar.com"
-
- - description: "Autolink url embedded in link tag"
- text: "<link rel='true'>http://example.com</link>"
- expected: "<link rel='true'><a href=\"http://example.com\">http://example.com</a></link>"
-
- - description: "Autolink multiple urls"
- text: "http://example.com https://sslexample.com http://sub.example.com"
- expected: "<a href=\"http://example.com\">http://example.com</a> <a href=\"https://sslexample.com\">https://sslexample.com</a> <a href=\"http://sub.example.com\">http://sub.example.com</a>"
-
- - description: "Autolink url with long TLD"
- text: "http://example.mobi/path"
- expected: "<a href=\"http://example.mobi/path\">http://example.mobi/path</a>"
-
- - description: "Autolink url containing ending with #value (not as url + hashtag)"
- text: "http://foo.com/?#foo"
- expected: "<a href=\"http://foo.com/?#foo\">http://foo.com/?#foo</a>"
-
- - description: "DO NOT Autolink url without protocol (with www)"
- text: "www.example.biz"
- expected: "www.example.biz"
-
- - description: "DO NOT Autolink url without protocol (with WWW)"
- text: "WWW.EXAMPLE.BIZ"
- expected: "WWW.EXAMPLE.BIZ"
-
- - description: "DO NOT Autolink URL without protocol and without www (ending in .com)"
- text: "foo.com"
- expected: "foo.com"
-
- - description: "DO NOT Autolink URL without protocol and without www (ending in .org)"
- text: "foo.org"
- expected: "foo.org"
-
- - description: "DO NOT Autolink URL without protocol and without www (ending in .net)"
- text: "foo.net"
- expected: "foo.net"
-
- - description: "DO NOT Autolink URL without protocol and without www (ending in .gov)"
- text: "foo.gov"
- expected: "foo.gov"
-
- - description: "DO NOT Autolink URL without protocol and without www (ending in .edu)"
- text: "foo.edu"
- expected: "foo.edu"
-
- - description: "Autolink URL without protocol and without www not ending in /.(edu|com|gov|org|net)/"
- text: "foo.it twitter.co.jp foo.commerce foo.nettastic foo.us foo.co.uk"
- expected: "foo.it twitter.co.jp foo.commerce foo.nettastic foo.us foo.co.uk"
-
- - description: "Multiple URLs with different protocols but not without a protocol"
- text: "http://foo.com AND https://bar.com AND www.foobar.com"
- expected: "<a href=\"http://foo.com\">http://foo.com</a> AND <a href=\"https://bar.com\">https://bar.com</a> AND www.foobar.com"
-
- - description: "Autolink raw domain followed by domain only links the first"
- text: "See http://example.com example.com"
- expected: "See <a href=\"http://example.com\">http://example.com</a> example.com"
-
- - description: "Autolink url that includes @-sign and numeric dir under it"
- text: "http://www.flickr.com/photos/29674651@N00/4382024406"
- expected: "<a href=\"http://www.flickr.com/photos/29674651@N00/4382024406\">http://www.flickr.com/photos/29674651@N00/4382024406</a>"
-
- - description: "Autolink url that includes @-sign and non-numeric dir under it"
- text: "http://www.flickr.com/photos/29674651@N00/foobar"
- expected: "<a href=\"http://www.flickr.com/photos/29674651@N00/foobar\">http://www.flickr.com/photos/29674651@N00/foobar</a>"
-
- - description: "Autolink url with a hashtag-looking fragment"
- text: "http://www.example.com/#answer"
- expected: "<a href=\"http://www.example.com/#answer\">http://www.example.com/#answer</a>"
-
- - description: "Autolink URL with only a domain followed by a period doesn't swallow the period."
- text: "I think it's proper to end sentences with a period http://tell.me.com. Even when they contain a URL."
- expected: "I think it's proper to end sentences with a period <a href=\"http://tell.me.com\">http://tell.me.com</a>. Even when they contain a URL."
-
- - description: "Autolink URL with a path followed by a period doesn't swallow the period."
- text: "I think it's proper to end sentences with a period http://tell.me/why. Even when they contain a URL."
- expected: "I think it's proper to end sentences with a period <a href=\"http://tell.me/why\">http://tell.me/why</a>. Even when they contain a URL."
-
- - description: "Autolink URL with a query followed by a period doesn't swallow the period."
- text: "I think it's proper to end sentences with a period http://tell.me/why?=because.i.want.it. Even when they contain a URL."
- expected: "I think it's proper to end sentences with a period <a href=\"http://tell.me/why?=because.i.want.it\">http://tell.me/why?=because.i.want.it</a>. Even when they contain a URL."
-
- - description: "Autolink URL with a hyphen in the domain name"
- text: "Czech out sweet deals at http://mrs.domain-dash.biz ok?"
- expected: "Czech out sweet deals at <a href=\"http://mrs.domain-dash.biz\">http://mrs.domain-dash.biz</a> ok?"
-
- - description: "Autolink an IDN (punycode) domain and TLD"
- text: "See also: http://xn--80abe5aohbnkjb.xn--p1ai/"
- expected: "See also: <a href=\"http://xn--80abe5aohbnkjb.xn--p1ai/\">http://xn--80abe5aohbnkjb.xn--p1ai/</a>"
-
- - description: "Autolink URL should NOT autolink www...foo"
- text: "Is www...foo a valid URL?"
- expected: "Is www...foo a valid URL?"
-
- - description: "Autolink URL should NOT autolink www.-foo.com"
- text: "Is www.-foo.com a valid URL?"
- expected: "Is www.-foo.com a valid URL?"
-
- - description: "Autolink URL should NOT autolink a domain with a valid dash but no protocol"
- text: "Is www.foo-bar.com a valid URL?"
- expected: "Is www.foo-bar.com a valid URL?"
-
- - description: "Autolink URL should autolink a domain with a valid dash and a protocol"
- text: "Is http://www.foo-bar.com a valid URL?"
- expected: "Is <a href=\"http://www.foo-bar.com\">http://www.foo-bar.com</a> a valid URL?"
-
- - description: "Autolink URL should link search urls (with &lang=, not &lang;)"
- text: "Check out http://search.twitter.com/#!/search?q=avro&lang=en"
- expected: "Check out <a href=\"http://search.twitter.com/#!/search?q=avro&amp;lang=en\">http://search.twitter.com/#!/search?q=avro&amp;lang=en</a>"
-
- - description: "Autolink URL should link urls with very long paths"
- text: "Check out http://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- expected: "Check out <a href=\"http://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\">http://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a>"
-
- - description: "Autolink URL should HTML escape the URL"
- text: "example: https://twitter.com/otm_m@\"onmousedown=\"alert('foo')\" style=background-color:yellow;color:yellow;\"/"
- expected: "example: <a href=\"https://twitter.com/otm_m\">https://twitter.com/otm_m</a>@\"onmousedown=\"alert('foo')\" style=background-color:yellow;color:yellow;\"/"
-
- - description: "Autolink URL should autolink a URL with a - or + at the end of the path"
- text: "Go to http://example.com/a+ or http://example.com/a-"
- expected: "Go to <a href=\"http://example.com/a+\">http://example.com/a+</a> or <a href=\"http://example.com/a-\">http://example.com/a-</a>"
-
- - description: "Autolink URL should autolink a URL with a - or + at the end of the path and query parameters"
- text: "Go to http://example.com/a+?this=that or http://example.com/a-?this=that"
- expected: "Go to <a href=\"http://example.com/a+?this=that\">http://example.com/a+?this=that</a> or <a href=\"http://example.com/a-?this=that\">http://example.com/a-?this=that</a>"
-
- - description: "Autolink URL should autolink URLs with longer paths ending in -"
- text: "Go to http://example.com/view/slug-url-?foo=bar"
- expected: "Go to <a href=\"http://example.com/view/slug-url-?foo=bar\">http://example.com/view/slug-url-?foo=bar</a>"
-
- - description: "Autolink URL should NOT link URLs with domains beginning in a space"
- text: "@user Try http:// example.com/path"
- expected: "@user Try http:// example.com/path"
-
- - description: "Autolink URL should NOT link URLs with domains beginning in a non-breaking space (U+00A0)"
- text: "@user Try http:// example.com/path"
- expected: "@user Try http:// example.com/path"
-
- - description: "Autolink URL should link paths containing accented characters"
- text: "See: http://example.com/café"
- expected: "See: <a href=\"http://example.com/café\">http://example.com/café</a>"
-
- - description: "Autolink URL should not link URL without protocol"
- text: "See: www.twitter.com or twitter.com/twitter"
- expected: "See: www.twitter.com or twitter.com/twitter"
-
- - description: "Autolink t.co URL followed by punctuation"
- text: "See: http://t.co/abcde's page"
- expected: "See: <a href=\"http://t.co/abcde\">http://t.co/abcde</a>'s page"
-
- - description: "DO NOT autolink URL if preceded by $"
- text: "$https://twitter.com $twitter.com $http://t.co/abcde $t.co/abcde $t.co $TVI.CA $RBS.CA"
- expected: "$https://twitter.com $twitter.com $http://t.co/abcde $t.co/abcde $t.co $TVI.CA $RBS.CA"
-
- cashtags:
- - description: "Autolink a cashtag"
- text: "$STOCK"
- expected: "<a href=\"https://twitter.com/#!/search?q=%24STOCK\" title=\"$STOCK\" class=\"tweet-url cashtag\">$STOCK</a>"
-
- - description: "Autolink a cashtag in text"
- text: "Text $STOCK text $symbol text"
- expected: "Text <a href=\"https://twitter.com/#!/search?q=%24STOCK\" title=\"$STOCK\" class=\"tweet-url cashtag\">$STOCK</a> text <a href=\"https://twitter.com/#!/search?q=%24symbol\" title=\"$symbol\" class=\"tweet-url cashtag\">$symbol</a> text"
-
- all:
- - description: "Autolink all does not break on URL with @"
- text: "http://www.flickr.com/photos/29674651@N00/4382024406 if you know what's good for you."
- expected: "<a href=\"http://www.flickr.com/photos/29674651@N00/4382024406\">http://www.flickr.com/photos/29674651@N00/4382024406</a> if you know what's good for you."
-
- - description: "Autolink all does not allow & without ?"
- text: "Check out: http://example.com/test&@chasesechrist"
- expected: "Check out: <a href=\"http://example.com/test\">http://example.com/test</a>&@chasesechrist"
-
- - description: "Correctly handles URL follower directly by @user"
- text: "See: http://example.com/@user"
- expected: "See: <a href=\"http://example.com/\">http://example.com/</a>@<a class=\"tweet-url username\" href=\"https://twitter.com/user\">user</a>"
-
- - description: "Correctly handles URL with an @user followed by trailing /"
- text: "See: http://example.com/@user/"
- expected: "See: <a href=\"http://example.com/@user/\">http://example.com/@user/</a>"
-
- - description: "Does not allow an XSS after an @"
- text: "See: http://x.xx.com/@\"style=\"color:pink\"onmouseover=alert(1)//"
- expected: "See: <a href=\"http://x.xx.com/\">http://x.xx.com/</a>@\"style=\"color:pink\"onmouseover=alert(1)//"
-
- - description: "DO NOT autolink URLs if preceded by # or @"
- text: "#https://twitter.com @https://twitter.com"
- expected: "#https://twitter.com @https://twitter.com"
-
- - description: "Autolink url with a hashtag-looking fragment"
- text: "http://www.example.com/#answer"
- expected: "<a href=\"http://www.example.com/#answer\">http://www.example.com/#answer</a>"
-
- - description: "Autolink hashtag if followed by . and TLD"
- text: "#twitter.com #twitter.co.jp"
- expected: "<a href=\"https://twitter.com/#!/search?q=%23twitter\" title=\"#twitter\" class=\"tweet-url hashtag\">#twitter</a>.com <a href=\"https://twitter.com/#!/search?q=%23twitter\" title=\"#twitter\" class=\"tweet-url hashtag\">#twitter</a>.co.jp"
-
- - description: "Autolink @mention if followed by . and TLD"
- text: "@twitter.com @twitter.co.jp"
- expected: "@<a class=\"tweet-url username\" href=\"https://twitter.com/twitter\">twitter</a>.com @<a class=\"tweet-url username\" href=\"https://twitter.com/twitter\">twitter</a>.co.jp"
-
- - description: "Autolink a cashtag"
- text: "$STOCK"
- expected: "<a href=\"https://twitter.com/#!/search?q=%24STOCK\" title=\"$STOCK\" class=\"tweet-url cashtag\">$STOCK</a>"
-
- json:
- - description: "Do not autolink if JSON is empty."
- text: "This is a tweet with no entity."
- json: '{"hashtags":[], "urls":[], "user_mentions":[]}'
- expected: "This is a tweet with no entity."
-
- - description: "Autolink username"
- text: "text @username"
- json: '{"hashtags":[], "urls":[], "user_mentions":[{"screen_name": "username", "name": "@username", "id": 318686216, "id_str": "318686216", "indices": [5, 14]}]}'
- expected: "text @<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>"
-
- - description: "Autolink hashtag"
- text: "text #hashtag"
- json: '{"hashtags":[{"text":"hashtag", "indices":[5,13]}], "urls":[], "user_mentions":[]}'
- expected: "text <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a>"
-
- - description: "Autolink URL"
- text: "text http://t.co/gksG6xlq"
- json: '{"hashtags":[], "urls":[{"url": "http://t.co/gksG6xlq", "expanded_url": "http://twitter.com/", "display_url": "twitter.com", "indices": [5, 25]}], "user_mentions":[]}'
- expected: "text <a href=\"http://t.co/gksG6xlq\" title=\"http://twitter.com/\"><span class='tco-ellipsis'><span style='position:absolute;left:-9999px;'>&nbsp;</span></span><span style='position:absolute;left:-9999px;'>http://</span><span class='js-display-url'>twitter.com</span><span style='position:absolute;left:-9999px;'>/</span><span class='tco-ellipsis'><span style='position:absolute;left:-9999px;'>&nbsp;</span></span></a>"
-
- - description: "Autolink all"
- text: "text http://t.co/gksG6xlq text #hashtag text @username"
- json: '{"hashtags":[{"text":"hashtag", "indices":[31,39]}], "urls":[{"url": "http://t.co/gksG6xlq", "expanded_url": "http://twitter.com/", "display_url": "twitter.com", "indices": [5, 25]}], "user_mentions":[{"screen_name": "username", "name": "@username", "id": 318686216, "id_str": "318686216", "indices": [45, 54]}]}'
- expected: "text <a href=\"http://t.co/gksG6xlq\" title=\"http://twitter.com/\"><span class='tco-ellipsis'><span style='position:absolute;left:-9999px;'>&nbsp;</span></span><span style='position:absolute;left:-9999px;'>http://</span><span class='js-display-url'>twitter.com</span><span style='position:absolute;left:-9999px;'>/</span><span class='tco-ellipsis'><span style='position:absolute;left:-9999px;'>&nbsp;</span></span></a> text <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\">#hashtag</a> text @<a class=\"tweet-url username\" href=\"https://twitter.com/username\">username</a>"
View
484 extract.yml
@@ -1,196 +1,4 @@
tests:
- mentions:
- - description: "Extract mention at the begining of a tweet"
- text: "@username reply"
- expected: ["username"]
-
- - description: "Extract mention at the end of a tweet"
- text: "mention @username"
- expected: ["username"]
-
- - description: "Extract mention in the middle of a tweet"
- text: "mention @username in the middle"
- expected: ["username"]
-
- - description: "Extract mention of username with underscore"
- text: "mention @user_name"
- expected: ["user_name"]
-
- - description: "Extract mention of all numeric username"
- text: "mention @12345"
- expected: ["12345"]
-
- - description: "Extract mention or multiple usernames"
- text: "mention @username1 @username2"
- expected: ["username1", "username2"]
-
- - description: "Extract mention in the middle of a Japanese tweet"
- text: "の@usernameに到着を待っている"
- expected: ["username"]
-
- - description: "DO NOT extract username ending in @"
- text: "Current Status: @_@ (cc: @username)"
- expected: ["username"]
-
- - description: "DO NOT extract username followed by accented latin characters"
- text: "@aliceìnheiro something something"
- expected: []
-
- - description: "Extract lone metion but not @user@user (too close to an email)"
- text: "@username email me @test@example.com"
- expected: ["username"]
-
- - description: "DO NOT extract 'http' in '@http://' as username"
- text: "@http://twitter.com"
- expected: []
-
- - description: "Extract mentions before newline"
- text: "@username\n@mention"
- expected: ["username", "mention"]
-
- - description: "Extract mentions after 'RT'"
- text: "RT@username RT:@mention RT @test"
- expected: ["username", "mention", "test"]
-
- - description: "DO NOT extract username preceded by !"
- text: "f!@kn"
- expected: []
-
- - description: "DO NOT extract username preceded by @"
- text: "f@@kn"
- expected: []
-
- - description: "DO NOT extract username preceded by #"
- text: "f#@kn"
- expected: []
-
- - description: "DO NOT extract username preceded by $"
- text: "f$@kn"
- expected: []
-
- - description: "DO NOT extract username preceded by %"
- text: "f%@kn"
- expected: []
-
- - description: "DO NOT extract username preceded by &"
- text: "f&@kn"
- expected: []
-
- - description: "DO NOT extract username preceded by *"
- text: "f*@kn"
- expected: []
-
- mentions_with_indices:
- - description: "Extract a mention at the start"
- text: "@username yo!"
- expected:
- - screen_name: "username"
- indices: [0, 9]
-
- - description: "Extract a mention that has the same thing mentioned at the start"
- text: "username @username"
- expected:
- - screen_name: "username"
- indices: [9, 18]
-
- - description: "Extract a mention in the middle of a Japanese tweet"
- text: "の@usernameに到着を待っている"
- expected:
- - screen_name: "username"
- indices: [1, 10]
-
- mentions_or_lists_with_indices:
- - description: "Extract a mention"
- text: "@username yo!"
- expected:
- - screen_name: "username"
- list_slug: ""
- indices: [0, 9]
-
- - description: "Extract a list"
- text: "@username/list-name is a great list!"
- expected:
- - screen_name: "username"
- list_slug: "/list-name"
- indices: [0, 19]
-
- - description: "Extract a mention and list"
- text: "Hey @username, check out out @otheruser/list_name-01!"
- expected:
- - screen_name: "username"
- list_slug: ""
- indices: [4, 13]
- - screen_name: "otheruser"
- list_slug: "/list_name-01"
- indices: [29, 52]
-
- - description: "Extract a list in the middle of a Japanese tweet"
- text: "の@username/list_name-01に到着を待っている"
- expected:
- - screen_name: "username"
- list_slug: "/list_name-01"
- indices: [1, 23]
-
- - description: "DO NOT extract a list with slug that starts with a number"
- text: "@username/7list-name is a great list!"
- expected:
- - screen_name: "username"
- list_slug: ""
- indices: [0, 9]
-
- replies:
- - description: "Extract reply at the begining of a tweet"
- text: "@username reply"
- expected: "username"
-
- - description: "Extract reply preceded by only a space"
- text: " @username reply"
- expected: "username"
-
- - description: "Extract reply preceded by only a full-width space (U+3000)"
- text: " @username reply"
- expected: "username"
-
- - description: "DO NOT Extract reply when preceded by text"
- text: "a @username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by ."
- text: ".@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by /"
- text: "/@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by _"
- text: "_@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by -"
- text: "-@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by +"
- text: "+@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by #"
- text: "#@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by !"
- text: "!@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when preceded by @"
- text: "@@username mention, not a reply"
- expected:
-
- - description: "DO NOT Extract reply when followed by URL"
- text: "@http://twitter.com"
- expected:
-
urls:
- description: "Extract a lone URL"
text: "http://example.com"
@@ -555,295 +363,3 @@ tests:
indices: [0, 11]
- url: "http://t.co"
indices: [12, 23]
-
- hashtags:
- - description: "Extract an all-alpha hashtag"
- text: "a #hashtag here"
- expected: ["hashtag"]
-
- - description: "Extract a letter-then-number hashtag"
- text: "this is #hashtag1"
- expected: ["hashtag1"]
-
- - description: "Extract a number-then-letter hashtag"
- text: "#1hashtag is this"
- expected: ["1hashtag"]
-
- - description: "DO NOT Extract an all-numeric hashtag"
- text: "On the #16 bus"
- expected: []
-
- - description: "DO NOT Extract a single numeric hashtag"
- text: "#0"
- expected: []
-
- - description: "Extract hashtag after bracket"
- text: "(#hashtag1 )#hashtag2 [#hashtag3 ]#hashtag4 ’#hashtag5’#hashtag6"
- expected: ["hashtag1", "hashtag2", "hashtag3", "hashtag4", "hashtag5", "hashtag6"]
-
- - description: "Extract a hashtag containing ñ"
- text: "I'll write more tests #mañana"
- expected: ["mañana"]
-
- - description: "Extract a hashtag containing é"
- text: "Working remotely #café"
- expected: ["café"]
-
- - description: "Extract a hashtag containing ü"
- text: "Getting my Oktoberfest on #münchen"
- expected: ["münchen"]
-
- - description: "DO NOT Extract a hashtag containing Japanese"
- text: "this is not valid: # 会議中 ハッシュ"
- expected: []
-
- - description: "Extract a hashtag in Korean"
- text: "What is #트위터 anyway?"
- expected: ["트위터"]
-
- - description: "Extract a half-width Hangul hashtag"
- text: "Just random half-width Hangul #ᆪᆭᄚ"
- expected: ["ᆪᆭᄚ"]
-
- - description: "Extract a hashtag in Russian"
- text: "What is #ашок anyway?"
- expected: ["ашок"]
-
- - description: "Extract a starting katakana hashtag"
- text: "#カタカナ is a hashtag"
- expected: ["カタカナ"]
-
- - description: "Extract a starting hiragana hashtag"
- text: "#ひらがな FTW!"
- expected: ["ひらがな"]
-
- - description: "Extract a starting kanji hashtag"
- text: "#漢字 is the future"
- expected: ["漢字"]
-
- - description: "Extract a trailing katakana hashtag"
- text: "Hashtag #カタカナ"
- expected: ["カタカナ"]
-
- - description: "Extract a trailing hiragana hashtag"
- text: "Japanese hashtags #ひらがな"
- expected: ["ひらがな"]
-
- - description: "Extract a trailing kanji hashtag"
- text: "Study time #漢字"
- expected: ["漢字"]
-
- - description: "Extract a central katakana hashtag"
- text: "See my #カタカナ hashtag?"
- expected: ["カタカナ"]
-
- - description: "Extract a central hiragana hashtag"
- text: "Study #ひらがな for fun and profit"
- expected: ["ひらがな"]
-
- - description: "Extract a central kanji hashtag"
- text: "Some say #漢字 is the past. what do they know?"
- expected: ["漢字"]
-
- - description: "Extract a Kanji/Katakana mixed hashtag"
- text: "日本語ハッシュタグテスト #日本語ハッシュタグ"
- expected: ["日本語ハッシュタグ"]
-
- - description: "Extract a hashtag after a punctuation"
- text: "日本語ハッシュテスト。#日本語ハッシュタグ"
- expected: ["日本語ハッシュタグ"]
-
- - description: "DO NOT include a punctuation in a hashtag"
- text: "#日本語ハッシュタグ。"
- expected: ["日本語ハッシュタグ"]
-
- - description: "Extract a full-width Alnum hashtag"
- text: "全角英数字ハッシュタグ #hashtag123"
- expected: ["hashtag123"]
-
- - description: "DO NOT extract a hashtag without a preceding space"
- text: "日本語ハッシュタグ#日本語ハッシュタグ"
- expected: []
-
- - description: "Hashtag with chouon"
- text: "長音ハッシュタグ。#サッカー"
- expected: ["サッカー"]
-
- - description: "Hashtag with half-width chouon"
- text: "長音ハッシュタグ。#サッカー"
- expected: ["サッカー"]
-
- - description: "Hashtag with half-widh voiced sounds marks"
- text: "#ハッシュタグ #パピプペポ"
- expected: ["ハッシュタグ", "パピプペポ"]
-
- - description: "Hashtag with half-width # after full-width !"
- text: "できましたよー!#日本語ハッシュタグ。"
- expected: ["日本語ハッシュタグ"]
-
- - description: "Hashtag with full-width # after full-width !"
- text: "できましたよー!#日本語ハッシュタグ。"
- expected: ["日本語ハッシュタグ"]
-
- - description: "Hashtag with ideographic iteration mark"
- text: "#云々 #学問のすゝめ #いすゞ #各〻 #〃"
- expected: ["云々", "学問のすゝめ", "いすゞ", "各〻", "〃"]
-
- - description: "Hashtags with ş (U+015F)"
- text: "Here’s a test tweet for you: #Ateş #qrşt #ştu #ş"
- expected: ["Ateş", "qrşt", "ştu", "ş"]
-
- - description: "Hashtags with İ (U+0130) and ı (U+0131)"
- text: "Here’s a test tweet for you: #İn #ın"
- expected: ["İn", "ın"]
-
- - description: "Hashtag before punctuations"
- text: "#hashtag: #hashtag; #hashtag, #hashtag. #hashtag! #hashtag?"
- expected: ["hashtag", "hashtag", "hashtag", "hashtag", "hashtag", "hashtag"]
-
- - description: "Hashtag after punctuations"
- text: ":#hashtag ;#hashtag ,#hashtag .#hashtag !#hashtag ?#hashtag"
- expected: ["hashtag", "hashtag", "hashtag", "hashtag", "hashtag", "hashtag"]
-
- - description: "Hashtag before newline"
- text: "#hashtag\ntest\n#hashtag2\ntest\n#hashtag3\n"
- expected: ["hashtag", "hashtag2", "hashtag3"]
-
- - description: "DO NOT extract hashtag when # is followed by URL"
- text: "#http://twitter.com #https://twitter.com"
- expected: []
-
- - description: "DO NOT extract hashtag if it's a part of URL"
- text: "http://twitter.com/#hashtag twitter.com/#hashtag"
- expected: []
-
- - description: "Extract hashtags with Latin extended characters"
- text: "#Azərbaycanca #mûǁae #Čeština #Ċaoiṁín"
- expected: ["Azərbaycanca", "mûǁae", "Čeština", "Ċaoiṁín"]
-
- - description: "Extract Arabic hashtags"
- text: "#سیاست #ایران #السياسة #السياح #لغات #اتمی #کنفرانس #العربية #الجزيرة #فارسی"
- expected: ["سیاست", "ایران", "السياسة", "السياح", "لغات", "اتمی", "کنفرانس", "العربية", "الجزيرة", "فارسی"]
-
- - description: "Extract Arabic hashtags with underscore"
- text: "#برنامه_نویسی #رییس_جمهور #رئيس_الوزراء, #ثبت_نام. #لس_آنجلس"
- expected: ["برنامه_نویسی", "رییس_جمهور", "رئيس_الوزراء", "ثبت_نام", "لس_آنجلس"]
-
- - description: "Extract Hebrew hashtags"
- text: "#עַל־יְדֵי #וכו׳ #מ״כ"
- expected: ["עַל־יְדֵי", "וכו׳", "מ״כ"]
-
- - description: "Extract Thai hashtags"
- text: "#ผู้เริ่ม #การเมือง #รายละเอียด #นักท่องเที่ยว #ของขวัญ #สนามบิน #เดินทาง #ประธาน"
- expected: ["ผู้เริ่ม", "การเมือง", "รายละเอียด", "นักท่องเที่ยว", "ของขวัญ", "สนามบิน", "เดินทาง", "ประธาน"]
-
- - description: "Extract Arabic hashtags with Zero-Width Non-Joiner"
- text: "#أي‌بي‌إم #می‌خواهم"
- expected: ["أي‌بي‌إم", "می‌خواهم"]
-
- hashtags_with_indices:
- - description: "Extract a hastag at the start"
- text: "#hashtag here"
- expected:
- - hashtag: "hashtag"
- indices: [0, 8]
-
- - description: "Extract a hastag at the end"
- text: "test a #hashtag"
- expected:
- - hashtag: "hashtag"
- indices: [7, 15]
-
- - description: "Extract a hastag in the middle"
- text: "test a #hashtag in a string"
- expected:
- - hashtag: "hashtag"
- indices: [7, 15]
-
- - description: "Extract only a valid hashtag"
- text: "#123 a #hashtag in a string"
- expected:
- - hashtag: "hashtag"
- indices: [7, 15]
-
- - description: "Extract a hashtag in a string of multi-byte characters"
- text: "会議中 #hashtag 会議中"
- expected:
- - hashtag: "hashtag"
- indices: [4, 12]
-
- - description: "Extract multiple valid hashtags"
- text: "One #two three #four"
- expected:
- - hashtag: "two"
- indices: [4, 8]
- - hashtag: "four"
- indices: [15, 20]
-
- - description: "Extract a non-latin hashtag"
- text: "Hashtags in #русский!"
- expected:
- - hashtag: "русский"
- indices: [12, 20]
-
- - description: "Extract multiple non-latin hashtags"
- text: "Hashtags in #中文, #日本語, #한국말, and #русский! Try it out!"
- expected:
- - hashtag: "中文"
- indices: [12, 15]
- - hashtag: "日本語"
- indices: [17, 21]
- - hashtag: "한국말"
- indices: [23, 27]
- - hashtag: "русский"
- indices: [33, 41]
-
- cashtags:
- - description: "Extract cashtags"
- text: "Example cashtags: $TEST $Stock $symbol"
- expected: ["TEST", "Stock", "symbol"]
-
- - description: "Extract cashtags with . or _"
- text: "Example cashtags: $TEST.T $test.tt $Stock_X $symbol_ab"
- expected: ["TEST.T", "test.tt", "Stock_X", "symbol_ab"]
-
- - description: "Do not extract cashtags if they contain numbers"
- text: "$123 $test123 $TE123ST"
- expected: []
-
- - description: "Do not extract cashtags with non-ASCII characters"
- text: "$ストック $株"
- expected: []
-
- - description: "Do not extract cashtags with punctuations"
- text: "$ $. $- $@ $! $() $+"
- expected: []
-
- - description: "Do not include trailing . or _"
- text: "$TEST. $TEST_"
- expected: ["TEST", "TEST"]
-
- - description: "Do not extract cashtags if there is no space before $"
- text: "$OK$NG$BAD text$NO .$NG $$NG"
- expected: ["OK"]
-
- - description: "Do not extract too long cashtags"
- text: "$CashtagMustBeLessThanSixCharacter"
- expected: []
-
- cashtags_with_indices:
- - description: "Extract cashtags"
- text: "Example: $TEST $symbol test"
- expected:
- - cashtag: "TEST"
- indices: [9, 14]
- - cashtag: "symbol"
- indices: [15, 22]
-
- - description: "Extract cashtags with . or _"
- text: "Example: $TEST.T test $symbol_ab end"
- expected:
- - cashtag: "TEST.T"
- indices: [9, 16]
- - cashtag: "symbol_ab"
- indices: [22, 32]
View
71 hit_highlighting.yml
@@ -1,73 +1,2 @@
tests:
- plain_text:
- - description: "Highlight the beginning of a string"
- text: "this is a test"
- hits: [ [0, 4] ]
- expected: "<em>this</em> is a test"
-
- - description: "Highlight the middle of a string"
- text: "this is a test"
- hits: [ [5, 7] ]
- expected: "this <em>is</em> a test"
-
- - description: "Highlight the end of a string"
- text: "this is a test"
- hits: [ [10, 14] ]
- expected: "this is a <em>test</em>"
-
- - description: "Highlight multiple terms"
- text: "this is a test"
- hits: [ [0, 4], [10, 14] ]
- expected: "<em>this</em> is a <em>test</em>"
-
- - description: "DO NOT highlight with empty hits"
- text: "this is a test"
- hits: []
- expected: "this is a test"
-
- - description: "Highlight within Japanese text"
- text: "東京の天気"
- hits: [ [0, 2] ]
- expected: "<em>東京</em>の天気"
-
- with_links:
- - description: "Highlight after a link (offset does not include markup)"
- text: "@<a href=\"http://twitter.com/username\">username</a> this is an example"
- hits: [ [10, 14] ]
- expected: "@<a href=\"http://twitter.com/username\">username</a> <em>this</em> is an example"
-
- - description: "Highlight anchor text of a link (offset does not include markup)"
- text: "@<a href=\"http://twitter.com/username\">username</a> this is an example"
- hits: [ [1, 9] ]
- expected: "@<a href=\"http://twitter.com/username\"><em>username</em></a> this is an example"
-
- - description: "Highlight around a link (offset does not include markup)"
- text: "@<a href=\"http://twitter.com/username\">username</a> this is an example"
- hits: [ [0, 14] ]
- expected: "<em>@<a href=\"http://twitter.com/username\">username</a> this</em> is an example"
-
- - description: "Highlight touching tags"
- text: "<a>foo</a><a>foo</a>"
- hits: [ [3, 6] ]
- expected: "<a>foo</a><a><em>foo</em></a>"
-
- - description: "Highlight two links"
- text: "foo <a>bar</a> <a>baz</a>"
- hits: [ [4, 7], [8, 11] ]
- expected: "foo <a><em>bar</em></a> <a><em>baz</em></a>"
-
- - description: "Highlight non-link then link not at end"
- text: "foo bar <a>baz</a> something else"
- hits: [ [4, 7], [8, 11] ]
- expected: "foo <em>bar</em> <a><em>baz</em></a> something else"
-
- - description: "Highlight non-link then link at end"
- text: "foo bar <a>baz</a>"
- hits: [ [4, 7], [8, 11] ]
- expected: "foo <em>bar</em> <a><em>baz</em></a>"
-
- - description: "Highlight mention at end"
- text: "something via @<a href=\"http://twitter.com/twitter\">twitter</a>"
- hits: [ [14, 22] ]
- expected: "something via <em>@<a href=\"http://twitter.com/twitter\">twitter</a></em>"
View
96 validate.yml
@@ -1,101 +1,5 @@
tests:
- tweets:
- - description: "Valid Tweet: < 20 characters"
- text: "I am a Tweet"
- expected: true
-
- - description: "Valid Tweet: 140 characters"
- text: "A lie gets halfway around the world before the truth has a chance to get its pants on. -- Winston Churchill (1874-1965) http://bit.ly/dJpywL"
- expected: true
-
- - description: "Valid Tweet: 140 characters (with accents)"
- text: "A lié géts halfway arøünd thé wørld béføré thé truth has a chance tø get its pants øn. -- Winston Churchill (1874-1965) http://bit.ly/dJpywL"
- expected: true
-
- - description: "Valid Tweet: 140 characters (double byte characters)"
- text: "のののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののののの"
- expected: true
-
- - description: "Invalid Tweet: no characters (empty)"
- text: ""
- expected: false
-
- - description: "Invalid Tweet: 141 characters"
- text: "A lie gets halfway around the world before the truth has a chance to get its pants on. --- Winston Churchill (1874-1965) http://bit.ly/dJpywL"
- expected: false
-
- - description: "Invalid Tweet: 141 characters (due to newline)"
- text: "A lie gets halfway around the world before the truth has a chance to get its pants on. \n-- Winston Churchill (1874-1965) http://bit.ly/dJpywL"
- expected: false
-
- usernames:
- - description: "Valid username: a-z < 20 characters"
- text: "@username"
- expected: true
-
- - description: "All numeric username are allowed"
- text: "@12345"
- expected: true
-
- - description: "Usernames should allow the _ character"
- text: "@example_name"
- expected: true
-
- - description: "Usernames SHOULD NOT allow the - character"
- text: "@example-name"
- expected: false
-
- lists:
- - description: "Valid list: a-z < 20 characters"
- text: "@username/list"
- expected: true
-
- - description: "A username alone SHOULD NOT be considered a valid list"
- text: "@username"
- expected: false
-
- - description: "A username followed by a slash SHOULD NOT be considered a valid list"
- text: "@username/"
- expected: false
-
- - description: "Validation SHOULD NOT allow leading spaces"
- text: " @username/list"
- expected: false
-
- - description: "Validation SHOULD NOT allow trailing spaces"
- text: "@username/list "
- expected: false
-
- hashtags:
- - description: "Valid hashtag: a-z < 20 characters"
- text: "#hashtag"
- expected: true
-
- - description: "Valid hashtag: number followed by letters"
- text: "#1st"
- expected: true
-
- - description: "Valid hashtag: letters and numbers mixed"
- text: "#that1time"
- expected: true
-
- - description: "Valid hashtag: letter followed by numbers"
- text: "#easyas123"
- expected: true
-
- - description: "Invalid hashtag: all numbers"
- text: "#12345"
- expected: false
-
- - description: "Valid hashtag: Russian text"
- text: "#ашок"
- expected: true
-
- - description: "Valid hashtag: Korean text"
- text: "#트위터"
- expected: true
-
urls:
- description: "Valid url: protocol + domain"
text: "http://example.com"

0 comments on commit 2412255

Please sign in to comment.
Something went wrong with that request. Please try again.