summaryrefslogtreecommitdiffstats
path: root/model/search_params_test.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2016-01-25 16:47:49 -0500
committerhmhealey <harrisonmhealey@gmail.com>2016-01-26 10:20:36 -0500
commit97ede2a428faf3a62ce0140e51ed591e261c09a1 (patch)
tree579a8970f42373bc99ed12dc6d46f0c47947815a /model/search_params_test.go
parentab5425f9b9f8a2e3ead637a27dc01bc9d06e16b7 (diff)
downloadchat-97ede2a428faf3a62ce0140e51ed591e261c09a1.tar.gz
chat-97ede2a428faf3a62ce0140e51ed591e261c09a1.tar.bz2
chat-97ede2a428faf3a62ce0140e51ed591e261c09a1.zip
Updated serverside hashtag regex to ignore more punctuation around words
Diffstat (limited to 'model/search_params_test.go')
-rw-r--r--model/search_params_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/model/search_params_test.go b/model/search_params_test.go
index af4cbe595..59eb0a113 100644
--- a/model/search_params_test.go
+++ b/model/search_params_test.go
@@ -118,19 +118,19 @@ func TestParseSearchFlags(t *testing.T) {
t.Fatalf("got incorrect flags %v", flags)
}
- if words, flags := parseSearchFlags(splitWords("fruit: cherry")); len(words) != 2 || words[0] != "fruit:" || words[1] != "cherry" {
+ if words, flags := parseSearchFlags(splitWords("fruit: cherry")); len(words) != 2 || words[0] != "fruit" || words[1] != "cherry" {
t.Fatalf("got incorrect words %v", words)
} else if len(flags) != 0 {
t.Fatalf("got incorrect flags %v", flags)
}
- if words, flags := parseSearchFlags(splitWords("channel:")); len(words) != 1 || words[0] != "channel:" {
+ if words, flags := parseSearchFlags(splitWords("channel:")); len(words) != 1 || words[0] != "channel" {
t.Fatalf("got incorrect words %v", words)
} else if len(flags) != 0 {
t.Fatalf("got incorrect flags %v", flags)
}
- if words, flags := parseSearchFlags(splitWords("channel: first in: second from:")); len(words) != 1 || words[0] != "from:" {
+ if words, flags := parseSearchFlags(splitWords("channel: first in: second from:")); len(words) != 1 || words[0] != "from" {
t.Fatalf("got incorrect words %v", words)
} else if len(flags) != 2 || flags[0][0] != "channel" || flags[0][1] != "first" || flags[1][0] != "in" || flags[1][1] != "second" {
t.Fatalf("got incorrect flags %v", flags)
@@ -212,4 +212,8 @@ func TestParseSearchParams(t *testing.T) {
if sp := ParseSearchParams("testing in:channel from:someone"); len(sp) != 1 || sp[0].Terms != "testing" || len(sp[0].InChannels) != 1 || sp[0].InChannels[0] != "channel" || len(sp[0].FromUsers) != 1 || sp[0].FromUsers[0] != "someone" {
t.Fatalf("Incorrect output from parse search params: %v", sp[0])
}
+
+ if sp := ParseSearchParams("##hashtag +#plus+"); len(sp) != 1 || sp[0].Terms != "#hashtag #plus" || sp[0].IsHashtag != true || len(sp[0].InChannels) != 0 || len(sp[0].FromUsers) != 0 {
+ t.Fatalf("Incorrect output from parse search params: %v", sp[0])
+ }
}