Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 79b04d364245ff0b6656f8ff8a3138e032f10498 1 parent 64578fb
Matt Sanford authored
Showing with 36 additions and 0 deletions.
  1. +16 −0 autolink.yml
  2. +20 −0 extract.yml
View
16 autolink.yml
@@ -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
20 extract.yml
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.