當前位置: 首頁>>代碼示例>>Golang>>正文


Golang assert.Equal函數代碼示例

本文整理匯總了Golang中github.com/harbur/captain/Godeps/_workspace/src/github.com/stretchr/testify/assert.Equal函數的典型用法代碼示例。如果您正苦於以下問題:Golang Equal函數的具體用法?Golang Equal怎麽用?Golang Equal使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Equal函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的github.com/harbur/captain/Godeps/_workspace/src/github.com/stretchr/testify/assert.Equal函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。