28 lines
550 B
Go
28 lines
550 B
Go
|
package track
|
||
|
|
||
|
import (
|
||
|
"github.com/matryer/is"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestTracker(t *testing.T) {
|
||
|
assert := is.New(t)
|
||
|
|
||
|
track := New()
|
||
|
|
||
|
track.Add("admin", "foo")
|
||
|
track.Add("mod", "foo")
|
||
|
track.Add("mod", "bar")
|
||
|
track.Add("mode", "bar")
|
||
|
|
||
|
admin := track.Search("I need an admin.")
|
||
|
assert.Equal(len(admin), 1) // One tracker for admin
|
||
|
|
||
|
mod := track.Search("I need a mod. Please send me a mod.")
|
||
|
assert.Equal(len(mod), 2) // Two trackers for mod
|
||
|
|
||
|
mode := track.Search("I'm in gaminga mode!")
|
||
|
assert.Equal(len(mode), 1) // One tracker for mode
|
||
|
|
||
|
}
|