Permalink
Browse files

Add in Keita's negative test cases and mixed-script cases

  • Loading branch information...
1 parent 64578fb commit 79b04d364245ff0b6656f8ff8a3138e032f10498 Matt Sanford committed Jun 13, 2011
Showing with 36 additions and 0 deletions.
  1. +16 −0 autolink.yml
  2. +20 −0 extract.yml
View
@@ -299,6 +299,22 @@ tests:
text: "#ひらがな"
expected: "<a href="http://twitter.com/search?q=%23ひらがな" title="#ひらがな" class="tweet-url hashtag">#ひらがな</a>"
+ - description: "Autolink a Kanji/Katakana mix hashtag"
+ text: "日本語ハッシュタグ #日本語ハッシュタグ"
+ expected: "日本語ハッシュタグ <a href="http://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="http://twitter.com/search?q=%23日本語ハッシュタグ" title="#日本語ハッシュタグ" class="tweet-url hashtag">#日本語ハッシュタグ</a>。"
+
+ - description: "Autolink a hashtag after a punctuation"
+ 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
@@ -368,6 +368,26 @@ tests:
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: []
+
hashtags_with_indices:
- description: "Extract a hastag at the start"
text: "#hashtag here"

0 comments on commit 79b04d3

Please sign in to comment.