Skip to content

Commit

Permalink
simplify slice expressions: s[:] => s (gin-gonic#1541)
Browse files Browse the repository at this point in the history
  • Loading branch information
Iskander (Alex) Sharipov authored and appleboy committed Sep 12, 2018
1 parent df1e17c commit 3f27866
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ func TestContextRenderProtoBuf(t *testing.T) {
assert.NoError(t, err)

assert.Equal(t, http.StatusCreated, w.Code)
assert.Equal(t, string(protoData[:]), w.Body.String())
assert.Equal(t, string(protoData), w.Body.String())
assert.Equal(t, "application/x-protobuf", w.HeaderMap.Get("Content-Type"))
}

Expand Down
20 changes: 10 additions & 10 deletions gin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestLoadHTMLGlob(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))

td()
}
Expand All @@ -101,7 +101,7 @@ func TestLoadHTMLGlob2(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))

td()
}
Expand All @@ -114,7 +114,7 @@ func TestLoadHTMLGlob3(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))

td()
}
Expand All @@ -134,7 +134,7 @@ func TestLoadHTMLGlobUsingTLS(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))

td()
}
Expand All @@ -148,7 +148,7 @@ func TestLoadHTMLGlobFromFuncMap(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "Date: 2017/07/01\n", string(resp[:]))
assert.Equal(t, "Date: 2017/07/01\n", string(resp))

td()
}
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestLoadHTMLFiles(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
td()
}

Expand All @@ -199,7 +199,7 @@ func TestLoadHTMLFiles2(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
td()
}

Expand All @@ -211,7 +211,7 @@ func TestLoadHTMLFiles3(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
td()
}

Expand All @@ -230,7 +230,7 @@ func TestLoadHTMLFilesUsingTLS(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
assert.Equal(t, "<h1>Hello world</h1>", string(resp))
td()
}

Expand All @@ -243,7 +243,7 @@ func TestLoadHTMLFilesFuncMap(t *testing.T) {
}

resp, _ := ioutil.ReadAll(res.Body)
assert.Equal(t, "Date: 2017/07/01\n", string(resp[:]))
assert.Equal(t, "Date: 2017/07/01\n", string(resp))

td()
}
Expand Down
2 changes: 1 addition & 1 deletion render/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func TestRenderProtoBuf(t *testing.T) {
err = (ProtoBuf{data}).Render(w)

assert.NoError(t, err)
assert.Equal(t, string(protoData[:]), w.Body.String())
assert.Equal(t, string(protoData), w.Body.String())
assert.Equal(t, "application/x-protobuf", w.Header().Get("Content-Type"))
}

Expand Down

0 comments on commit 3f27866

Please sign in to comment.