本文整理汇总了Golang中github.com/pilu/miniassert.Equal函数的典型用法代码示例。如果您正苦于以下问题:Golang Equal函数的具体用法?Golang Equal怎么用?Golang Equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Equal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestRequest_Param
func TestRequest_Param(t *testing.T) {
r, _ := http.NewRequest("GET", "http:///example.com?f=foo&b=bar", nil)
request := newRequest(r)
assert.Equal(t, "foo", request.Param("f"))
assert.Equal(t, "bar", request.Param("b"))
}
示例2: TestRecordingsHandler_WithReleaseIdNotFound
func TestRecordingsHandler_WithReleaseIdNotFound(t *testing.T) {
recorder := newTestRequest("GET", "/releases/00000000-0000-0000-0000-000000000000/recordings.json")
body := string(recorder.Body.Bytes())
assert.Equal(t, `{"error":"release not found"}`+"\n", body)
assert.Equal(t, 404, recorder.Code)
}
示例3: TestRouter_Add
func TestRouter_Add(t *testing.T) {
router := New()
assert.Equal(t, 0, len(router.routes["GET"]))
route := router.Add(HttpMethod("GET"), "/", httpHandlerExample)
assert.Type(t, "*traffic.Route", route)
assert.Equal(t, 1, len(router.routes["GET"]))
}
示例4: TestEnvironment_Url
func TestEnvironment_Url(t *testing.T) {
e := &Environment{Live: false}
assert.Equal(t, "http://test.lyricfind.com/api_service", e.Url().String())
e = &Environment{Live: true}
assert.Equal(t, "http://api.lyricfind.com", e.Url().String())
}
示例5: TestRecordingsHandler_WithExistingdIdAndNonExsistingArtistId
func TestRecordingsHandler_WithExistingdIdAndNonExsistingArtistId(t *testing.T) {
recorder := newTestRequest("GET", "/artists/00000000-0000-0000-0000-000000000000/releases/79215cdf-4764-4dee-b0b9-fec1643df7c5/recordings.json")
body := string(recorder.Body.Bytes())
assert.Equal(t, `{"error":"artist not found"}`+"\n", body)
assert.Equal(t, 404, recorder.Code)
}
示例6: TestArtistHandler_WithIdNotFound
func TestArtistHandler_WithIdNotFound(t *testing.T) {
recorder := newTestRequest("GET", "/artists/00000000-0000-0000-0000-000000000000.json")
body := string(recorder.Body.Bytes())
assert.Equal(t, `{"error":"artist not found"}`+"\n", body)
assert.Equal(t, 404, recorder.Code)
}
示例7: TestNewData
func TestNewData(t *testing.T) {
data := NewData()
assert.Equal(t, VERSION, data.Version)
assert.Equal(t, []string{"log", "backtrace", "type"}, data.Columns)
assert.Equal(t, 0, len(data.Rows))
}
示例8: TestArtistHandler_WithInvalidUUID
func TestArtistHandler_WithInvalidUUID(t *testing.T) {
recorder := newTestRequest("GET", "/artists/bad-uuid.json")
body := string(recorder.Body.Bytes())
assert.Equal(t, "", body)
assert.Equal(t, 400, recorder.Code)
}
示例9: TestGeometry_String
func TestGeometry_String(t *testing.T) {
g := Geometry{200, 300}
assert.Equal(t, "200x300", g.String())
g = Geometry{200, 0}
assert.Equal(t, "200x", g.String())
}
示例10: TestEncode
func TestEncode(t *testing.T) {
assert.Equal(t, "0", Encode(0))
assert.Equal(t, "1b", Encode(99))
assert.Equal(t, "QNZ", Encode(101405))
assert.Equal(t, "15y79wVi9XQ", Encode(920110421043409228))
}
示例11: TestRouter_Delete
func TestRouter_Delete(t *testing.T) {
router := New()
assert.Equal(t, 0, len(router.routes["DELETE"]))
route := router.Delete("/", httpHandlerExample)
assert.Type(t, "*traffic.Route", route)
assert.Equal(t, 1, len(router.routes["DELETE"]))
}
示例12: TestRecordingsHandler_WithInvalidReleaseId
func TestRecordingsHandler_WithInvalidReleaseId(t *testing.T) {
recorder := newTestRequest("GET", "/releases/bad-uuid/recordings.json")
body := string(recorder.Body.Bytes())
assert.Equal(t, "", body)
assert.Equal(t, 400, recorder.Code)
}
示例13: TestRouter_Patch
func TestRouter_Patch(t *testing.T) {
router := New()
assert.Equal(t, 0, len(router.routes["PATCH"]))
route := router.Patch("/", httpHandlerExample)
assert.Type(t, "*traffic.Route", route)
assert.Equal(t, 1, len(router.routes["PATCH"]))
}
示例14: TestLogData_Add
func TestLogData_Add(t *testing.T) {
logData := make(LogData, 0)
assert.Equal(t, 0, len(logData))
logData.Add(1)
assert.Equal(t, 1, len(logData))
}
示例15: TestNewLogRow
func TestNewLogRow(t *testing.T) {
logData := make(LogData, 0)
row := NewLogRow(&logData, "foo.go:100", "log")
assert.Equal(t, &logData, (*row)[0])
assert.Equal(t, "foo.go:100", (*row)[1])
assert.Equal(t, "log", (*row)[2])
}