smartystreets / goconvey

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
http://smartystreets.github.io/goconvey/
Other
8.23k stars 554 forks source link

map[int64]bool ShouldContainKey didn't work as expected #662

Closed guojiex closed 2 years ago

guojiex commented 2 years ago
func TestContainsKey(t *testing.T) {
    Convey("Test IntersectMapsByKey", t, func() {
        map1 := map[int64]bool{
            1: true,
        }
        So(map1, ShouldContainKey, int64(1))
        So(map1, ShouldContainKey, 1)
    })
}

the first assertion passed, while the second one will fail, error msg:

Expected the map[int64]bool to contain the key: [1] (but it didn't)!

My current temp solution will be:

So(map1[1], ShouldBeTrue)

guojiex commented 2 years ago

This should be a problem of https://github.com/smartystreets/assertions, I will open a bug there.