summaryrefslogtreecommitdiffstats
path: root/model/utils_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-11 13:03:14 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-11 13:03:14 -0500
commitb660acf8f893972c56817cfa49e8318f40aa32a0 (patch)
treef13bbb7255ddfa078afa4400313c733e10ed3cf7 /model/utils_test.go
parentce03fbc6d8176b6d5a903312241a948f59785a04 (diff)
downloadchat-b660acf8f893972c56817cfa49e8318f40aa32a0.tar.gz
chat-b660acf8f893972c56817cfa49e8318f40aa32a0.tar.bz2
chat-b660acf8f893972c56817cfa49e8318f40aa32a0.zip
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 1f1e5f023..512a026e4 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)
+ }
+ }
+}