本文整理汇总了Golang中github.com/velour/catbase/bot.NewMockBot函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMockBot函数的具体用法?Golang NewMockBot怎么用?Golang NewMockBot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMockBot函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestHelp
func TestHelp(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
c.Help("channel", []string{})
assert.Len(t, mb.Messages, 1)
}
开发者ID:velour,项目名称:catbase,代码行数:7,代码来源:reminder_test.go
示例2: makePlugin
func makePlugin(t *testing.T) (*RememberPlugin, *Factoid, *bot.MockBot) {
mb := bot.NewMockBot()
f := New(mb) // for DB table
p := NewRemember(mb)
assert.NotNil(t, p)
return p, f, mb
}
开发者ID:velour,项目名称:catbase,代码行数:7,代码来源:remember_test.go
示例3: makePlugin
func makePlugin(t *testing.T) (*LeftpadPlugin, *bot.MockBot) {
mb := bot.NewMockBot()
counter.New(mb)
p := New(mb)
assert.NotNil(t, p)
return p, mb
}
开发者ID:velour,项目名称:catbase,代码行数:7,代码来源:leftpad_test.go
示例4: makeBeersPlugin
func makeBeersPlugin(t *testing.T) (*BeersPlugin, *bot.MockBot) {
mb := bot.NewMockBot()
counter.New(mb)
b := New(mb)
assert.NotNil(t, b)
return b, mb
}
开发者ID:velour,项目名称:catbase,代码行数:7,代码来源:beers_test.go
示例5: TestBabblerMerge
func TestBabblerMerge(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
c.config.Babbler.DefaultUsers = []string{"seabass"}
assert.NotNil(t, c)
seabass := makeMessage("<seabass> This is a message")
seabass.User = &user.User{Name: "seabass"}
res := c.Message(seabass)
assert.Len(t, c.babblers, 1)
assert.Len(t, mb.Messages, 0)
seabass.Body = "<seabass> This is another message"
res = c.Message(seabass)
seabass.Body = "<seabass> This is a long message"
res = c.Message(seabass)
res = c.Message(makeMessage("!merge babbler seabass into seabass2"))
assert.True(t, res)
assert.Len(t, mb.Messages, 1)
assert.Contains(t, mb.Messages[0], "mooooiggged")
res = c.Message(makeMessage("!seabass2 says"))
assert.True(t, res)
assert.Len(t, mb.Messages, 2)
assert.Contains(t, mb.Messages[1], "<seabass2> this is")
assert.Contains(t, mb.Messages[1], "message")
}
开发者ID:velour,项目名称:catbase,代码行数:30,代码来源:babbler_test.go
示例6: TestSay
func TestSay(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("say hello"))
assert.Len(t, mb.Messages, 0)
assert.False(t, res)
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:talker_test.go
示例7: TestBadSides
func TestBadSides(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("!1daoeu"))
assert.False(t, res)
assert.Len(t, mb.Messages, 0)
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:dice_test.go
示例8: TestNonJoinEvent
func TestNonJoinEvent(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Event("SPLURT", makeMessage("hello there"))
assert.Len(t, mb.Messages, 0)
assert.False(t, res)
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:talker_test.go
示例9: TestCounterOne
func TestCounterOne(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
c.Message(makeMessage("test++"))
assert.Len(t, mb.Messages, 1)
assert.Equal(t, mb.Messages[0], "tester has 1 test.")
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:counter_test.go
示例10: TestNotCommand
func TestNotCommand(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("1d6"))
assert.False(t, res)
assert.Len(t, mb.Messages, 0)
}
开发者ID:velour,项目名称:catbase,代码行数:8,代码来源:dice_test.go
示例11: TestReminderParse
func TestReminderParse(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("!remind testuser in unparseable don't fail this test"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "Easy cowboy, not sure I can parse that duration.")
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:reminder_test.go
示例12: TestSayCommand
func TestSayCommand(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("!say hello"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "hello")
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:talker_test.go
示例13: TestNoSayings
func TestNoSayings(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
c.sayings = []string{}
assert.NotNil(t, c)
res := c.Event("JOIN", makeMessage("hello there"))
assert.Len(t, mb.Messages, 0)
assert.False(t, res)
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:talker_test.go
示例14: TestLotsOfDice
func TestLotsOfDice(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("!100d100"))
assert.True(t, res)
assert.Len(t, mb.Messages, 1)
assert.Contains(t, mb.Messages[0], "You're a dick.")
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:dice_test.go
示例15: TestDice
func TestDice(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
res := c.Message(makeMessage("!5d6"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "tester, you rolled:")
}
开发者ID:velour,项目名称:catbase,代码行数:9,代码来源:dice_test.go
示例16: TestNineChars
func TestNineChars(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
c.enforceNicks = true
assert.NotNil(t, c)
res := c.Message(makeMessage("hello there"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "OCD")
}
开发者ID:velour,项目名称:catbase,代码行数:10,代码来源:talker_test.go
示例17: TestBabblerNoBabbler
func TestBabblerNoBabbler(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
c.config.Babbler.DefaultUsers = []string{"seabass"}
assert.NotNil(t, c)
res := c.Message(makeMessage("!seabass2 says"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "could not find babbler: seabass2")
}
开发者ID:velour,项目名称:catbase,代码行数:10,代码来源:babbler_test.go
示例18: TestCounterFour
func TestCounterFour(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
assert.NotNil(t, c)
for i := 0; i < 4; i++ {
c.Message(makeMessage("test++"))
}
assert.Len(t, mb.Messages, 4)
assert.Equal(t, mb.Messages[3], "tester has 4 test.")
}
开发者ID:velour,项目名称:catbase,代码行数:10,代码来源:counter_test.go
示例19: TestBabblerNothingSaid
func TestBabblerNothingSaid(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
c.config.Babbler.DefaultUsers = []string{"seabass"}
assert.NotNil(t, c)
res := c.Message(makeMessage("!seabass says"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "Ze ain't said nothin")
}
开发者ID:velour,项目名称:catbase,代码行数:10,代码来源:babbler_test.go
示例20: TestWelcome
func TestWelcome(t *testing.T) {
mb := bot.NewMockBot()
c := New(mb)
c.sayings = []string{"Hi"}
assert.NotNil(t, c)
res := c.Event("JOIN", makeMessage("hello there"))
assert.Len(t, mb.Messages, 1)
assert.True(t, res)
assert.Contains(t, mb.Messages[0], "Hi")
}
开发者ID:velour,项目名称:catbase,代码行数:10,代码来源:talker_test.go
注:本文中的github.com/velour/catbase/bot.NewMockBot函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论