本文整理汇总了Golang中github.com/pilu/miniassert.Equal函数的典型用法代码示例。如果您正苦于以下问题:Golang Equal函数的具体用法?Golang Equal怎么用?Golang Equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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"))
}
开发者ID:jmptrader,项目名称:traffic,代码行数:7,代码来源:request_test.go
示例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)
}
开发者ID:pilu,项目名称:cerebellum,代码行数:7,代码来源:recordings_handler_test.go
示例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"]))
}
开发者ID:jmptrader,项目名称:traffic,代码行数:7,代码来源:router_test.go
示例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())
}
开发者ID:pilu,项目名称:lyricfind,代码行数:7,代码来源:client_test.go
示例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)
}
开发者ID:pilu,项目名称:cerebellum,代码行数:7,代码来源:recordings_handler_test.go
示例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)
}
开发者ID:pilu,项目名称:cerebellum,代码行数:7,代码来源:artist_handler_test.go
示例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))
}
开发者ID:pilu,项目名称:traffic-chromelogger,代码行数:7,代码来源:data_test.go
示例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)
}
开发者ID:pilu,项目名称:cerebellum,代码行数:7,代码来源:artist_handler_test.go
示例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())
}
开发者ID:pilu,项目名称:matrioska,代码行数:7,代码来源:geometry_test.go
示例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))
}
开发者ID:jcoene,项目名称:go-base62,代码行数:7,代码来源:base62_test.go
示例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"]))
}
开发者ID:jmptrader,项目名称:traffic,代码行数:7,代码来源:router_test.go
示例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)
}
开发者ID:pilu,项目名称:cerebellum,代码行数:7,代码来源:recordings_handler_test.go
示例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"]))
}
开发者ID:jmptrader,项目名称:traffic,代码行数:7,代码来源:router_test.go
示例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))
}
开发者ID:pilu,项目名称:traffic-chromelogger,代码行数:8,代码来源:data_test.go
示例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])
}
开发者ID:pilu,项目名称:traffic-chromelogger,代码行数:8,代码来源:data_test.go
示例16: TestPublicPath
func TestPublicPath(t *testing.T) {
InitSettings()
assert.Equal(t, DefaultPublicPath, PublicPath())
os.Setenv("PUBLIC_PATH", "./foo")
InitSettings()
assert.Equal(t, "./foo", PublicPath())
}
开发者ID:pilu,项目名称:matrioska,代码行数:8,代码来源:settings_test.go
示例17: TestPort
func TestPort(t *testing.T) {
InitSettings()
assert.Equal(t, DefaultPort, Port())
os.Setenv("PORT", "12345")
InitSettings()
assert.Equal(t, "12345", Port())
}
开发者ID:pilu,项目名称:matrioska,代码行数:8,代码来源:settings_test.go
示例18: TestRootHandler
func TestRootHandler(t *testing.T) {
recorder := newTestRequest("GET", "/")
expectedBody := fmt.Sprintf(`{"version":"%s"}`, VERSION) + "\n"
assert.Equal(t, []string{"application/json"}, recorder.HeaderMap["Content-Type"])
assert.Equal(t, expectedBody, string(recorder.Body.Bytes()))
assert.Equal(t, 200, recorder.Code)
}
开发者ID:pilu,项目名称:microphone,代码行数:8,代码来源:root_handler_test.go
示例19: TestLogger_Add
func TestLogger_Add(t *testing.T) {
logger := newLogger()
assert.Equal(t, 0, len(logger.data.Rows))
logger.add("foo", "log")
assert.Equal(t, 1, len(logger.data.Rows))
}
开发者ID:pilu,项目名称:traffic-chromelogger,代码行数:8,代码来源:logger_test.go
示例20: TestRouter_GetVar
func TestRouter_GetVar(t *testing.T) {
defer resetGlobalEnv()
router := New()
env["global-foo"] = "global-foo"
assert.Equal(t, "global-foo", router.GetVar("global-foo"))
router.env["global-foo"] = "router-foo"
assert.Equal(t, "router-foo", router.GetVar("global-foo"))
}
开发者ID:jmptrader,项目名称:traffic,代码行数:8,代码来源:router_test.go
注:本文中的github.com/pilu/miniassert.Equal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论