Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add test cases for Hiragana, Katakana and Kanji hashtags

  • Loading branch information...
commit fe8fc08ca1b3a86dc996e15c0a93218d33706a33 1 parent 3aca14d
Matt Sanford authored
Showing with 144 additions and 0 deletions.
  1. +108 −0 autolink.yml
  2. +36 −0 extract.yml
View
108 autolink.yml
@@ -191,6 +191,114 @@ tests:
text: "What is #ашок anyway?"
expected: "What is <a href=\"http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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="http://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"
View
36 extract.yml
@@ -332,6 +332,42 @@ tests:
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: ["漢字"]
+
hashtags_with_indices:
- description: "Extract a hastag at the start"
text: "#hashtag here"
Please sign in to comment.
Something went wrong with that request. Please try again.