summaryrefslogtreecommitdiffstats
path: root/model/utils_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-12-16 09:09:11 -0500
committerChristopher Speller <crspeller@gmail.com>2015-12-16 09:09:11 -0500
commit3e418a100a3a491ebff7ba72ac003dd06752a30a (patch)
treece321f1a197d7bcf5f43c7acf8c49b01363461f5 /model/utils_test.go
parenta13fbfe493974319378949dd54c0523da4ea86c2 (diff)
parentb660acf8f893972c56817cfa49e8318f40aa32a0 (diff)
downloadchat-3e418a100a3a491ebff7ba72ac003dd06752a30a.tar.gz
chat-3e418a100a3a491ebff7ba72ac003dd06752a30a.tar.bz2
chat-3e418a100a3a491ebff7ba72ac003dd06752a30a.zip
Merge pull request #1710 from mattermost/plt-1498
PLT-1498 Add hashtag testing and allow special german characters
Diffstat (limited to 'model/utils_test.go')
-rw-r--r--model/utils_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/model/utils_test.go b/model/utils_test.go
index aab535fc9..24ee4b7a6 100644
--- a/model/utils_test.go
+++ b/model/utils_test.go
@@ -81,3 +81,27 @@ func TestEtag(t *testing.T) {
t.Fatal()
}
}
+
+var hashtags map[string]string = map[string]string{
+ "#test": "#test",
+ "test": "",
+ "#test123": "#test123",
+ "#123test123": "",
+ "#test-test": "#test-test",
+ "#test?": "#test",
+ "hi #there": "#there",
+ "#bug #idea": "#bug #idea",
+ "#bug or #gif!": "#bug #gif",
+ "#hüllo": "#hüllo",
+ "#?test": "",
+ "#-test": "",
+ "#yo_yo": "#yo_yo",
+}
+
+func TestParseHashtags(t *testing.T) {
+ for input, output := range hashtags {
+ if o, _ := ParseHashtags(input); o != output {
+ t.Fatal("expected=" + output + " actual=" + o)
+ }
+ }
+}