-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some tests and fixed some lint errors
- Loading branch information
Andre Hahn
committed
Jun 17, 2016
1 parent
5982171
commit 098da0d
Showing
4 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package bot | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func RouteTest(t *testing.T) { | ||
route := []string{"a", "b"} | ||
topic := []string{"a", "b"} | ||
if !RouteIncludesTopic(route, topic) { | ||
t.Fail() | ||
} | ||
|
||
topic = []string{"a", "b", "c"} | ||
if RouteIncludesTopic(route, topic) { | ||
t.Fail() | ||
} | ||
|
||
route = []string{"a", "b", "c"} | ||
topic = []string{"a", "b"} | ||
if RouteIncludesTopic(route, topic) { | ||
t.Fail() | ||
} | ||
} | ||
|
||
func WildcardTest(t *testing.T) { | ||
route := []string{"#"} | ||
topic := []string{"anything", "really"} | ||
if !RouteIncludesTopic(route, topic) { | ||
t.Fail() | ||
} | ||
|
||
route = []string{"+", "level"} | ||
topic = []string{"something", "level"} | ||
if !RouteIncludesTopic(route, topic) { | ||
t.Fail() | ||
} | ||
} |