• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang assert.Equal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/bfontaine/stargazer/Godeps/_workspace/src/github.com/stretchr/testify/assert.Equal函数的典型用法代码示例。如果您正苦于以下问题:Golang Equal函数的具体用法?Golang Equal怎么用?Golang Equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestSimpleMessage

func TestSimpleMessage(t *testing.T) {
	message, err := unmarshalMessage(simpleMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "C2147483705", message.Channel)
	assert.Equal(t, "U2147483697", message.User)
	assert.Equal(t, "Hello world", message.Text)
	assert.Equal(t, "1355517523.000005", message.Timestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:10,代码来源:messages_test.go


示例2: TestGroupLeaveMessage

func TestGroupLeaveMessage(t *testing.T) {
	message, err := unmarshalMessage(groupLeaveMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "group_leave", message.SubType)
	assert.Equal(t, "1358877455.000010", message.Timestamp)
	assert.Equal(t, "U2147483828", message.User)
	assert.Equal(t, "<@U2147483828|cal> has left the group", message.Text)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:10,代码来源:messages_test.go


示例3: TestGroupUnarchiveMessage

func TestGroupUnarchiveMessage(t *testing.T) {
	message, err := unmarshalMessage(groupUnarchiveMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "group_unarchive", message.SubType)
	assert.Equal(t, "1361482916.000003", message.Timestamp)
	assert.Equal(t, "<U1234|@cal> un-archived the group", message.Text)
	assert.Equal(t, "U1234", message.User)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:10,代码来源:messages_test.go


示例4: TestGroupJoinMessage

func TestGroupJoinMessage(t *testing.T) {
	message, err := unmarshalMessage(groupJoinMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "group_join", message.SubType)
	assert.Equal(t, "1358877458.000011", message.Timestamp)
	assert.Equal(t, "U2147483828", message.User)
	assert.Equal(t, "<@U2147483828|cal> has joined the group", message.Text)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:10,代码来源:messages_test.go


示例5: TestMessageDeletedMessage

func TestMessageDeletedMessage(t *testing.T) {
	message, err := unmarshalMessage(messageDeletedMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "message_deleted", message.SubType)
	assert.True(t, message.Hidden)
	assert.Equal(t, "C2147483705", message.Channel)
	assert.Equal(t, "1358878755.000001", message.Timestamp)
	assert.Equal(t, "1358878749.000002", message.DeletedTimestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:messages_test.go


示例6: TestPost

func TestPost(t *testing.T) {
	message, err := unmarshalMessage(testPost)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "file_share", message.SubType)
	assert.Equal(t, "<@U2147483697|tester> shared a file: <https://test.slack.com/files/tester/abc/test_post|test post>", message.Text)
	// TODO: Assert File
	assert.Equal(t, "U2147483697", message.User)
	assert.False(t, message.Upload)
	assert.Equal(t, "1433315416.000008", message.Timestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:12,代码来源:messages_test.go


示例7: TestComment

func TestComment(t *testing.T) {
	message, err := unmarshalMessage(testComment)
	fmt.Println(err)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "file_comment", message.SubType)
	assert.Equal(t, "<@U2147483697|tester> commented on <@U2147483697|tester>'s file <https://test.slack.com/files/tester/abc/test_post|test post>: another comment", message.Text)
	// TODO: Assert File
	// TODO: Assert Comment
	assert.Equal(t, "1433316360.000009", message.Timestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:12,代码来源:messages_test.go


示例8: TestUploadedFile

func TestUploadedFile(t *testing.T) {
	message, err := unmarshalMessage(uploadedFile)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "file_share", message.SubType)
	assert.Equal(t, "<@U2147483697|tester> uploaded a file: <https://test.slack.com/files/tester/abc/test.txt|test.txt> and commented: test comment here", message.Text)
	// TODO: Assert File
	assert.Equal(t, "U2147483697", message.User)
	assert.True(t, message.Upload)
	assert.Equal(t, "1433314757.000006", message.Timestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:12,代码来源:messages_test.go


示例9: TestFileShareMessage

func TestFileShareMessage(t *testing.T) {
	message, err := unmarshalMessage(fileShareMessage)
	fmt.Println(err)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "file_share", message.SubType)
	assert.Equal(t, "1358877455.000010", message.Timestamp)
	assert.Equal(t, "<@cal> uploaded a file: <https:...7.png|7.png>", message.Text)
	assert.Equal(t, "U2147483697", message.User)
	assert.True(t, message.Upload)
	assert.NotNil(t, message.File)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:13,代码来源:messages_test.go


示例10: assertSimpleGroup

func assertSimpleGroup(t *testing.T, group *Group) {
	assert.NotNil(t, group)
	assert.Equal(t, "G024BE91L", group.ID)
	assert.Equal(t, "secretplans", group.Name)
	assert.Equal(t, true, group.IsGroup)
	assert.Equal(t, JSONTime(1360782804), group.Created)
	assert.Equal(t, "U024BE7LH", group.Creator)
	assert.Equal(t, false, group.IsArchived)
	assert.Equal(t, "1401383885.000061", group.LastRead)
	assert.Equal(t, 0, group.UnreadCount)
	assert.Equal(t, 0, group.UnreadCountDisplay)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:12,代码来源:conversation_test.go


示例11: TestStarNotification

func TestStarNotification(t *testing.T) {
	s := Star{
		Added:     true,
		User:      "U123",
		Timestamp: "1401",
		Message: Message{
			User:      "U321",
			Channel:   "C123",
			Text:      "yo",
			Timestamp: "1400",
		},
	}

	slackInfo = &slack.Info{
		Team: &slack.Team{
			Name:   "yolo",
			Domain: "yoloo",
		},
	}

	n, err := s.notification()
	assert.Nil(t, err)

	assert.Equal(t,
		"@usernameU123 just starred your message in #channelC123: https://yoloo.slack.com/archives/channelC123/p1400",
		n)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:27,代码来源:stars_test.go


示例12: TestMemoizeGetter

func TestMemoizeGetter(t *testing.T) {
	var calls int

	f := func(s string) (string, error) {
		calls++
		if s == "error" {
			return "", errors.New("oops")
		}
		return "called:" + s, nil
	}

	memoized := memoizeGetter(f)

	require.NotNil(t, memoized)
	assert.Equal(t, 0, calls)

	s, err := memoized("yo")
	assert.Nil(t, err)
	assert.Equal(t, "called:yo", s)
	assert.Equal(t, 1, calls)

	s, err = memoized("yo")
	assert.Nil(t, err)
	assert.Equal(t, "called:yo", s)
	assert.Equal(t, 1, calls)

	s, err = memoized("error")
	assert.NotNil(t, err)
	assert.Equal(t, 2, calls)

	s, err = memoized("error")
	assert.NotNil(t, err)
	assert.Equal(t, 3, calls)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:34,代码来源:slackutils_test.go


示例13: TestMessageChangedMessage

func TestMessageChangedMessage(t *testing.T) {
	message, err := unmarshalMessage(messageChangedMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "message_changed", message.SubType)
	assert.True(t, message.Hidden)
	assert.Equal(t, "C2147483705", message.Channel)
	assert.NotNil(t, message.SubMessage)
	assert.Equal(t, "message", message.SubMessage.Type)
	assert.Equal(t, "U2147483697", message.SubMessage.User)
	assert.Equal(t, "Hello, world!", message.SubMessage.Text)
	assert.Equal(t, "1355517523.000005", message.SubMessage.Timestamp)
	assert.NotNil(t, message.SubMessage.Edited)
	assert.Equal(t, "U2147483697", message.SubMessage.Edited.User)
	assert.Equal(t, "1358878755.000001", message.SubMessage.Edited.Timestamp)
	assert.Equal(t, "1358878755.000001", message.Timestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:18,代码来源:messages_test.go


示例14: assertSimpleIM

func assertSimpleIM(t *testing.T, im *IM) {
	assert.NotNil(t, im)
	assert.Equal(t, "D024BFF1M", im.ID)
	assert.Equal(t, true, im.IsIM)
	assert.Equal(t, JSONTime(1360782804), im.Created)
	assert.Equal(t, false, im.IsUserDeleted)
	assert.Equal(t, true, im.IsOpen)
	assert.Equal(t, "1401383885.000061", im.LastRead)
	assert.Equal(t, 0, im.UnreadCount)
	assert.Equal(t, 0, im.UnreadCountDisplay)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:conversation_test.go


示例15: TestGotDM

func TestGotDM(t *testing.T) {
	assert.Equal(t, enablingMessage, gotDM("d123", "u1", "enable"))
	assert.Equal(t, enablingMessage, gotDM("d123", "u2", "enable"))
	assert.Equal(t, enabledMessage, gotDM("d123", "u1", "enable"))

	assert.Equal(t, disabledMessage, gotDM("d123", "u3", "disable"))
	assert.Equal(t, disablingMessage, gotDM("d123", "u1", "disable"))
	assert.Equal(t, disabledMessage, gotDM("d123", "u1", "disable"))

	assert.Equal(t, "", gotDM("d123", "u4", "hello who are you"))
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:main_test.go


示例16: TestGroupNameMessage

func TestGroupNameMessage(t *testing.T) {
	message, err := unmarshalMessage(groupNameMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "group_name", message.SubType)
	assert.Equal(t, "1358877455.000010", message.Timestamp)
	assert.Equal(t, "U2147483828", message.User)
	assert.Equal(t, "random", message.OldName)
	assert.Equal(t, "watercooler", message.Name)
	assert.Equal(t, "<@U2147483828|cal> has renamed the group from \"random\" to \"watercooler\"", message.Text)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:12,代码来源:messages_test.go


示例17: TestGroupTopicMessage

func TestGroupTopicMessage(t *testing.T) {
	message, err := unmarshalMessage(groupTopicMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "group_topic", message.SubType)
	assert.Equal(t, "1358877455.000010", message.Timestamp)
	assert.Equal(t, "U2147483828", message.User)
	assert.Equal(t, "hello world", message.Topic)
	assert.Equal(t, "<@U2147483828|cal> set the group topic: hello world", message.Text)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:messages_test.go


示例18: TestMeMessage

func TestMeMessage(t *testing.T) {
	message, err := unmarshalMessage(meMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "me_message", message.SubType)
	assert.Equal(t, "C2147483705", message.Channel)
	assert.Equal(t, "U2147483697", message.User)
	assert.Equal(t, "is doing that thing", message.Text)
	assert.Equal(t, "1355517523.000005", message.Timestamp)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:messages_test.go


示例19: TestChannelJoinInvitedMessage

func TestChannelJoinInvitedMessage(t *testing.T) {
	message, err := unmarshalMessage(channelJoinInvitedMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "channel_join", message.SubType)
	assert.Equal(t, "1358877458.000011", message.Timestamp)
	assert.Equal(t, "U2147483828", message.User)
	assert.Equal(t, "<@U2147483828|cal> has joined the channel", message.Text)
	assert.Equal(t, "U2147483829", message.Inviter)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:messages_test.go


示例20: TestGroupPurposeMessage

func TestGroupPurposeMessage(t *testing.T) {
	message, err := unmarshalMessage(groupPurposeMessage)
	assert.Nil(t, err)
	assert.NotNil(t, message)
	assert.Equal(t, "message", message.Type)
	assert.Equal(t, "group_purpose", message.SubType)
	assert.Equal(t, "1358877455.000010", message.Timestamp)
	assert.Equal(t, "U2147483828", message.User)
	assert.Equal(t, "whatever", message.Purpose)
	assert.Equal(t, "<@U2147483828|cal> set the group purpose: whatever", message.Text)
}
开发者ID:bfontaine,项目名称:stargazer,代码行数:11,代码来源:messages_test.go



注:本文中的github.com/bfontaine/stargazer/Godeps/_workspace/src/github.com/stretchr/testify/assert.Equal函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang assert.Nil函数代码示例发布时间:2022-05-24
下一篇:
Golang SBMSystem.LogFile类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap