Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Add test cases for Hiragana, Katakana and Kanji hashtags
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Sanford committed Jun 9, 2011
1 parent 3aca14d commit fe8fc08
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 0 deletions.
108 changes: 108 additions & 0 deletions autolink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
36 changes: 36 additions & 0 deletions extract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit fe8fc08

Please sign in to comment.