本文整理汇总了Golang中github.com/stvp/assert.Equal函数的典型用法代码示例。如果您正苦于以下问题:Golang Equal函数的具体用法?Golang Equal怎么用?Golang Equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestCreateFileRefNoLine
func TestCreateFileRefNoLine(t *testing.T) {
ref := CreateFileRef("pkg/src/example_item.ft:145", false)
assert.NotNil(t, ref)
assert.Equal(t, ref.Path, "pkg/src/example_item.ft")
assert.Equal(t, ref.Line, 145)
assert.Equal(t, ref.LineType, RefLineTypeNew)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:7,代码来源:file_ref_test.go
示例2: TestCreateFileRefDeletedLineOverride
func TestCreateFileRefDeletedLineOverride(t *testing.T) {
ref := CreateFileRef("pkg/src/example_item.ft:145", true)
assert.NotNil(t, ref)
assert.Equal(t, ref.Path, "pkg/src/example_item.ft")
assert.Equal(t, ref.Line, 145)
assert.Equal(t, ref.LineType, RefLineTypeOld)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:7,代码来源:file_ref_test.go
示例3: TestCreateFileMultiColon
func TestCreateFileMultiColon(t *testing.T) {
ref := CreateFileRef("pkg/src/item:other.txt:98", false)
assert.NotNil(t, ref)
assert.Equal(t, ref.Path, "pkg/src/item:other.txt")
assert.Equal(t, ref.Line, 98)
assert.Equal(t, ref.LineType, RefLineTypeNew)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:7,代码来源:file_ref_test.go
示例4: TestGetAllWantedGames
func TestGetAllWantedGames(t *testing.T) {
print("GetAllWantedGames\n")
seedGame()
user := gu(t)
c, err := GetConsole("Atari 2600", user)
assert.Nil(t, err, "GetConsole(Atari 2600,user)")
c2, err := GetConsole("NES", user)
assert.Nil(t, err, "GetConsole(NES,user)")
print("\tInitial\n")
wg, err := GetAllWantedGames()
assert.Nil(t, err, "GetAllWantedGames()")
assert.Equal(t, 0, len(wg), "GetAllWantedGames")
print("\tMarking individual games\n")
g, err := GetGame(1, user)
assert.Nil(t, err, "GetGame(1,user)")
g.Want = true
err = g.Save()
assert.Nil(t, err, "g.Save()")
wg, err = GetAllWantedGames()
assert.Nil(t, err, "GetAllWantedGames()")
assert.Equal(t, 1, len(wg), "GetAllWantedGames()")
print("\tMarking Console WantGames\n")
c.WantGames = true
err = c.Save()
assert.Nil(t, err, "c.Save()")
c2.WantGames = true
err = c2.Save()
assert.Nil(t, err, "c2.Save()")
wg, err = GetAllWantedGames()
assert.Nil(t, err, "GetAllWantedGames()")
assert.Equal(t, 1321, len(wg), "GetAllWantedGames()")
}
开发者ID:ChrisKaufmann,项目名称:gameslist,代码行数:35,代码来源:game_test.go
示例5: TestCreateFileNoLine
func TestCreateFileNoLine(t *testing.T) {
ref := CreateFileRef("pkg/src/item:other.txt", false)
assert.NotNil(t, ref)
assert.Equal(t, ref.Path, "pkg/src/item:other.txt")
assert.Equal(t, ref.Line, 0)
assert.Equal(t, ref.LineType, RefLineTypeNew)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:7,代码来源:file_ref_test.go
示例6: TestAllMarkedEntries
func TestAllMarkedEntries(t *testing.T) {
e := ef()
assert.Equal(t, 0, len(AllMarkedEntries("test")))
err := e.Mark()
assert.Nil(t, err)
assert.Equal(t, 1, len(AllMarkedEntries("test")))
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:7,代码来源:entry_test.go
示例7: TestPropertiesFromBlob
func TestPropertiesFromBlob(t *testing.T) {
content := "fruit Green Apple\ntree_type Redwood\n\nThe Redwood is the tallest tree in North America"
blob := CreatePropertyBlob(content)
fruit := blob.Get("fruit")
tree := blob.Get("tree_type")
assert.Equal(t, "Green Apple", *fruit)
assert.Equal(t, "Redwood", *tree)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:8,代码来源:property_blob_test.go
示例8: TestCreatePersonFromSpacedNameEmailTime
func TestCreatePersonFromSpacedNameEmailTime(t *testing.T) {
p, err := CreatePerson("Carrie Ann McBean <[email protected]>").Dematerialize()
assert.Nil(t, err)
person := p.(*Person)
assert.NotNil(t, person)
assert.Equal(t, person.Email, "[email protected]")
assert.Equal(t, person.Name, "Carrie Ann McBean")
}
开发者ID:git-comment,项目名称:git-comment,代码行数:8,代码来源:person_test.go
示例9: TestCategory_Excludes
func TestCategory_Excludes(t *testing.T) {
seed()
c1 := GetCat("1")
assert.Equal(t, 0, len(c1.Excludes()))
c1.Exclude = "a,b,c,d,"
c1.Save()
assert.Equal(t, 4, len(c1.Excludes()))
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:8,代码来源:category_test.go
示例10: TestFilter_Manual
func TestFilter_Manual(t *testing.T) {
print("Filter_Manual\n")
c := gsc(t)
gl, err := c.Games()
assert.Nil(t, err, "c.Games()")
assert.Equal(t, 1, len(Filter(gl).Manual(true)), "FilterManual(true)")
assert.Equal(t, 800, len(Filter(gl).Manual(false)), "FilterManual(false)")
}
开发者ID:ChrisKaufmann,项目名称:gameslist,代码行数:8,代码来源:game_test.go
示例11: TestCreatePersonFromNameEmailTime
func TestCreatePersonFromNameEmailTime(t *testing.T) {
p, err := CreatePerson("Carrie <[email protected]> 1437612685 -0700").Dematerialize()
assert.Nil(t, err)
person := p.(*Person)
assert.NotNil(t, person)
assert.Equal(t, person.Email, "[email protected]")
assert.Equal(t, person.Name, "Carrie")
}
开发者ID:git-comment,项目名称:git-comment,代码行数:8,代码来源:person_test.go
示例12: TestCreatePersonWithoutName
func TestCreatePersonWithoutName(t *testing.T) {
p, err := CreatePerson("<[email protected]>").Dematerialize()
assert.Nil(t, err)
person := p.(*Person)
assert.NotNil(t, person)
assert.Equal(t, person.Email, "[email protected]")
assert.Equal(t, person.Name, "")
}
开发者ID:git-comment,项目名称:git-comment,代码行数:8,代码来源:person_test.go
示例13: TestNewCommentAuthor
func TestNewCommentAuthor(t *testing.T) {
author := &Person{"Sam Wafers", "<[email protected]>", time.Now(), "-0600"}
c, err := NewComment("Curious decision here.", "123", nil, author).Dematerialize()
comment := c.(*Comment)
assert.Nil(t, err)
assert.NotNil(t, comment)
assert.Equal(t, comment.Author, author)
assert.Equal(t, comment.Amender, author)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:9,代码来源:comment_test.go
示例14: TestGetCategories
func TestGetCategories(t *testing.T) {
seed()
assert.Equal(t, 4, len(GetCategories("test")))
var newcat Category
newcat.Name = "newest!"
newcat.UserName = "test"
newcat.Insert("test")
assert.Equal(t, 5, len(GetCategories("test")))
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:9,代码来源:category_test.go
示例15: TestCategory_ReadEntries
func TestCategory_ReadEntries(t *testing.T) {
seed()
c1 := GetCat("1")
assert.Equal(t, 0, len(c1.ReadEntries()))
e1 := GetEntry("1", "test")
err := e1.MarkRead()
assert.Nil(t, err)
assert.Equal(t, 1, len(c1.ReadEntries()))
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:9,代码来源:category_test.go
示例16: TestCategory_DeleteExcludes
func TestCategory_DeleteExcludes(t *testing.T) {
seed()
c1 := GetCat("1")
c1.DeleteExcludes()
assert.Equal(t, 4, c1.Unread())
c1.Exclude = "asdf"
c1.DeleteExcludes()
assert.Equal(t, 2, c1.Unread())
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:9,代码来源:category_test.go
示例17: TestCategory_FeedsStr
func TestCategory_FeedsStr(t *testing.T) {
seed()
c1 := GetCat("1")
assert.Equal(t, 2, len(c1.FeedsStr()))
f4, err := GetFeed(4)
assert.Nil(t, err)
f4.CategoryID = 1
f4.Save()
assert.Equal(t, 3, len(c1.FeedsStr()))
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:10,代码来源:category_test.go
示例18: TestNewCommentTime
func TestNewCommentTime(t *testing.T) {
var unix int64 = 1433220431
c, err := NewComment("ELI5?", "123", nil, &Person{Date: time.Unix(unix, 0)}).Dematerialize()
comment := c.(*Comment)
assert.Nil(t, err)
assert.NotNil(t, comment.Author)
assert.Equal(t, comment.Author.Date.Unix(), unix)
assert.NotNil(t, comment.Amender)
assert.Equal(t, comment.Amender.Date, comment.Author.Date)
}
开发者ID:git-comment,项目名称:git-comment,代码行数:10,代码来源:comment_test.go
示例19: TestEntry_AutoscrollPX
func TestEntry_AutoscrollPX(t *testing.T) {
e := ef()
assert.Equal(t, 0, e.AutoscrollPX())
f, err := GetFeed(1)
assert.Nil(t, err)
f.AutoscrollPX = 1234
err = f.Save()
assert.Nil(t, err)
assert.Equal(t, 1234, e.AutoscrollPX())
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:10,代码来源:entry_test.go
示例20: TestEntry_ViewMode
func TestEntry_ViewMode(t *testing.T) {
e := ef()
assert.Equal(t, "default", e.ViewMode(), "initial entry.ViewMode")
f, err := GetFeed(1)
assert.Nil(t, err, "GetFeed(1)")
f.ViewMode = "link"
err = f.Save()
assert.Nil(t, err)
assert.Equal(t, "link", e.ViewMode())
}
开发者ID:ChrisKaufmann,项目名称:feedinator-go,代码行数:10,代码来源:entry_test.go
注:本文中的github.com/stvp/assert.Equal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论