本文整理汇总了Golang中github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/stretchr/testify/assert.Equal函数的典型用法代码示例。如果您正苦于以下问题:Golang Equal函数的具体用法?Golang Equal怎么用?Golang Equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Equal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestConnect
func TestConnect(t *testing.T) {
c.Connect("127.0.0.1:45678")
assert.Equal(t, c.Host, "127.0.0.1")
assert.Equal(t, c.Server, "127.0.0.1:45678")
waitConnAndClose(t)
initTestClient()
}
示例2: TestToFloat64
func TestToFloat64(t *testing.T) {
var eight interface{} = 8
assert.Equal(t, ToFloat64(8), 8.00)
assert.Equal(t, ToFloat64(8.31), 8.31)
assert.Equal(t, ToFloat64("8.31"), 8.31)
assert.Equal(t, ToFloat64(eight), 8.0)
}
示例3: TestMarshal
func TestMarshal(t *testing.T) {
SetDefault("port", 1313)
Set("name", "Steve")
type config struct {
Port int
Name string
}
var C config
err := Marshal(&C)
if err != nil {
t.Fatalf("unable to decode into struct, %v", err)
}
assert.Equal(t, &C, &config{Name: "Steve", Port: 1313})
Set("port", 1234)
err = Marshal(&C)
if err != nil {
t.Fatalf("unable to decode into struct, %v", err)
}
assert.Equal(t, &C, &config{Name: "Steve", Port: 1234})
}
示例4: TestAliasInConfigFile
func TestAliasInConfigFile(t *testing.T) {
// the config file specifies "beard". If we make this an alias for
// "hasbeard", we still want the old config file to work with beard.
RegisterAlias("beard", "hasbeard")
assert.Equal(t, true, Get("hasbeard"))
Set("hasbeard", false)
assert.Equal(t, false, Get("beard"))
}
示例5: TestNick
func TestNick(t *testing.T) {
c.Nick("test2")
assert.Equal(t, "test2", c.GetNick())
assert.Equal(t, "NICK test2\r\n", <-conn.hook)
c.writeNick("nick")
assert.Equal(t, "NICK nick\r\n", <-conn.hook)
}
示例6: TestAddRemoveUser
func TestAddRemoveUser(t *testing.T) {
channelStore := NewChannelStore()
channelStore.AddUser("user", "srv", "#chan")
channelStore.AddUser("user2", "srv", "#chan")
assert.Equal(t, channelStore.GetUsers("srv", "#chan"), []string{"user", "user2"})
channelStore.RemoveUser("user", "srv", "#chan")
assert.Equal(t, []string{"user2"}, channelStore.GetUsers("srv", "#chan"))
}
示例7: TestRenameUser
func TestRenameUser(t *testing.T) {
channelStore := NewChannelStore()
channelStore.AddUser("user", "srv", "#chan1")
channelStore.AddUser("user", "srv", "#chan2")
channelStore.RenameUser("user", "new", "srv")
assert.Equal(t, []string{"new"}, channelStore.GetUsers("srv", "#chan1"))
assert.Equal(t, []string{"new"}, channelStore.GetUsers("srv", "#chan2"))
}
示例8: TestIndirectPointers
func TestIndirectPointers(t *testing.T) {
x := 13
y := &x
z := &y
assert.Equal(t, ToInt(y), 13)
assert.Equal(t, ToInt(z), 13)
}
示例9: TestLevels
func TestLevels(t *testing.T) {
SetStdoutThreshold(LevelError)
assert.Equal(t, StdoutThreshold(), LevelError)
SetLogThreshold(LevelCritical)
assert.Equal(t, LogThreshold(), LevelCritical)
assert.NotEqual(t, StdoutThreshold(), LevelCritical)
SetStdoutThreshold(LevelWarn)
assert.Equal(t, StdoutThreshold(), LevelWarn)
}
示例10: TestQuit
func TestQuit(t *testing.T) {
c.connected = true
c.Quit()
assert.Equal(t, "QUIT\r\n", <-conn.hook)
_, ok := <-c.quit
assert.Equal(t, false, ok)
initTestClient()
}
示例11: TestWrite
func TestWrite(t *testing.T) {
c.write("test")
assert.Equal(t, "test\r\n", <-conn.hook)
c.Write("test")
assert.Equal(t, "test\r\n", <-conn.hook)
c.writef("test %d", 2)
assert.Equal(t, "test 2\r\n", <-conn.hook)
c.Writef("test %d", 2)
assert.Equal(t, "test 2\r\n", <-conn.hook)
}
示例12: TestConnectDefaultPorts
func TestConnectDefaultPorts(t *testing.T) {
c.Connect("127.0.0.1")
assert.Equal(t, "127.0.0.1:6667", c.Server)
initTestClient()
c.TLS = true
c.Connect("127.0.0.1")
assert.Equal(t, "127.0.0.1:6697", c.Server)
initTestClient()
}
示例13: TestMode
func TestMode(t *testing.T) {
channelStore := NewChannelStore()
channelStore.AddUser("+user", "srv", "#chan")
channelStore.SetMode("srv", "#chan", "user", "o", "v")
assert.Equal(t, []string{"@user"}, channelStore.GetUsers("srv", "#chan"))
channelStore.SetMode("srv", "#chan", "user", "v", "")
assert.Equal(t, []string{"+user"}, channelStore.GetUsers("srv", "#chan"))
channelStore.SetMode("srv", "#chan", "user", "", "v")
assert.Equal(t, []string{"user"}, channelStore.GetUsers("srv", "#chan"))
}
示例14: TestMarshalling
func TestMarshalling(t *testing.T) {
SetConfigType("yaml")
r := bytes.NewReader(yamlExample)
marshalReader(r, v.config)
assert.True(t, InConfig("name"))
assert.False(t, InConfig("state"))
assert.Equal(t, "steve", Get("name"))
assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, Get("hobbies"))
assert.Equal(t, map[interface{}]interface{}{"jacket": "leather", "trousers": "denim"}, Get("clothing"))
assert.Equal(t, 35, Get("age"))
}
示例15: TestReadBufConfig
func TestReadBufConfig(t *testing.T) {
v := New()
v.SetConfigType("yaml")
v.ReadConfig(bytes.NewBuffer(yamlExample))
t.Log(v.AllKeys())
assert.True(t, v.InConfig("name"))
assert.False(t, v.InConfig("state"))
assert.Equal(t, "steve", v.Get("name"))
assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, v.Get("hobbies"))
assert.Equal(t, map[interface{}]interface{}{"jacket": "leather", "trousers": "denim"}, v.Get("clothing"))
assert.Equal(t, 35, v.Get("age"))
}