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

Golang assert.Equal函数代码示例

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

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



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

示例1: TestFilterConfigWeb

func TestFilterConfigWeb(t *testing.T) {
	c := NewConfig("", "test/Simple/captain.yml", false)
	assert.Equal(t, 2, len(c.GetApps()), "Should return 2 apps")

	c.FilterConfig("web")
	assert.Equal(t, 1, len(c.GetApps()), "Should return 1 app")
	assert.Equal(t, "Dockerfile", c.GetApp("web").Build, "Should return web Build field")
}
开发者ID:lunohq,项目名称:captain,代码行数:8,代码来源:config_test.go


示例2: TestFilterConfigEmpty

func TestFilterConfigEmpty(t *testing.T) {
	c := NewConfig("", "test/Simple/captain.yml", false)
	assert.Equal(t, 2, len(c.GetApps()), "Should return 2 apps")

	res := c.FilterConfig("")
	assert.True(t, res, "Should return true")
	assert.Equal(t, 2, len(c.GetApps()), "Should return 2 apps")
}
开发者ID:lunohq,项目名称:captain,代码行数:8,代码来源:config_test.go


示例3: TestFilterConfigNonExistent

func TestFilterConfigNonExistent(t *testing.T) {
	c := NewConfig("", "test/Simple/captain.yml", false)
	assert.Equal(t, 2, len(c.GetApps()), "Should return 2 apps")

	res := c.FilterConfig("nonexistent")
	assert.False(t, res, "Should return false")
	assert.Equal(t, 0, len(c.GetApps()), "Should return 0 apps")
}
开发者ID:lunohq,项目名称:captain,代码行数:8,代码来源:config_test.go


示例4: TestTagNonexistingImage

func TestTagNonexistingImage(t *testing.T) {
	app := App{Image: "golang"}
	res := tagImage(app, "nonexist", "testing")
	expected := errors.New("no such image")
	assert.Equal(t, expected, res, "Docker tag should return an error")
	println()
}
开发者ID:ejholmes,项目名称:captain,代码行数:7,代码来源:docker_test.go


示例5: TestGitIsDirty

func TestGitIsDirty(t *testing.T) {
	assert.Equal(t, false, isDirty(), "Git should not have local changes")
}
开发者ID:ejholmes,项目名称:captain,代码行数:3,代码来源:git_test.go


示例6: TestGitGetBranch

func TestGitGetBranch(t *testing.T) {
	assert.Equal(t, "master", getBranch(), "Git branch should be master")
}
开发者ID:ejholmes,项目名称:captain,代码行数:3,代码来源:git_test.go


示例7: TestExecute

func TestExecute(t *testing.T) {
	res := execute("echo", "testing")
	assert.Equal(t, nil, res, "it should execute without errors")
}
开发者ID:lunohq,项目名称:captain,代码行数:4,代码来源:execute_test.go


示例8: TestOnelinerTrimmed

func TestOnelinerTrimmed(t *testing.T) {
	res, _ := oneliner("echo", "testing with spaces  ")
	assert.Equal(t, "testing with spaces", res, "it should return the trimmed result")
}
开发者ID:lunohq,项目名称:captain,代码行数:4,代码来源:execute_test.go


示例9: TestGitGetBranchAllBranches

func TestGitGetBranchAllBranches(t *testing.T) {
	assert.Equal(t, []string{"master"}, getBranches(true), "Git branch should be master")
}
开发者ID:fstehle,项目名称:captain,代码行数:3,代码来源:git_test.go


示例10: TestGitGetRevisionFullSha

func TestGitGetRevisionFullSha(t *testing.T) {
	assert.Equal(t, 40, len(getRevision(true)), "Git revision should have a length of 40 chars")
}
开发者ID:fstehle,项目名称:captain,代码行数:3,代码来源:git_test.go


示例11: TestImageExist

func TestImageExist(t *testing.T) {
	app := App{Image: "golang"}
	exist := imageExist(app, "1.4")
	assert.Equal(t, true, exist, "Docker image golang:1.4 should exist")
}
开发者ID:ejholmes,项目名称:captain,代码行数:5,代码来源:docker_test.go


示例12: TestConfigFiles

func TestConfigFiles(t *testing.T) {
	options.config = "captain.yml"
	c := configFile(options)
	sl := "captain.yml"
	assert.Equal(t, sl, c, "Should return possible config files")
}
开发者ID:ejholmes,项目名称:captain,代码行数:6,代码来源:config_test.go


示例13: TestGetApp

func TestGetApp(t *testing.T) {
	options.config = "test/Simple/captain.yml"
	c := NewConfig(options, false)
	app := c.GetApp("web")
	assert.Equal(t, "harbur/test_web", app.Image, "Should return web image")
}
开发者ID:ejholmes,项目名称:captain,代码行数:6,代码来源:config_test.go


示例14: TestGitIsGit

func TestGitIsGit(t *testing.T) {
	assert.Equal(t, true, isGit(), "There should be a git repository")
}
开发者ID:ejholmes,项目名称:captain,代码行数:3,代码来源:git_test.go


示例15: TestImageDoesNotExist

func TestImageDoesNotExist(t *testing.T) {
	app := App{Image: "golang"}
	exist := imageExist(app, "nonexist")
	assert.Equal(t, false, exist, "Docker image golang:nonexist should not exist")
}
开发者ID:ejholmes,项目名称:captain,代码行数:5,代码来源:docker_test.go


示例16: TestGitGetRevision

func TestGitGetRevision(t *testing.T) {
	assert.Equal(t, 7, len(getRevision()), "Git revision should have length 7 chars")
}
开发者ID:ejholmes,项目名称:captain,代码行数:3,代码来源:git_test.go


示例17: TestColorCodes

func TestColorCodes(t *testing.T) {
	assert.Equal(t, "\x1b[32mhello\x1b[0m", colorInfo("hello"), "they should be equal")
	assert.Equal(t, "\x1b[33mhello\x1b[0m", colorWarn("hello"), "they should be equal")
	assert.Equal(t, "\x1b[31mhello\x1b[0m", colorErr("hello"), "they should be equal")
}
开发者ID:ejholmes,项目名称:captain,代码行数:5,代码来源:colors_test.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang trace.Tracer类代码示例发布时间:2022-05-23
下一篇:
Golang mtp.StorageInfo类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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