Skip to content

Commit

Permalink
test: simplify bytes.Buffer declaration (#1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Mar 18, 2023
1 parent faf565e commit 0be5a41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions bytesconv_table_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ func main() {
return a
}()

w := new(bytes.Buffer)
w.WriteString(pre)
w := bytes.NewBufferString(pre)
fmt.Fprintf(w, "const hex2intTable = %q\n", hex2intTable)
fmt.Fprintf(w, "const toLowerTable = %q\n", toLowerTable)
fmt.Fprintf(w, "const toUpperTable = %q\n", toUpperTable)
Expand Down
12 changes: 4 additions & 8 deletions http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2740,8 +2740,7 @@ func TestResponseImmediateHeaderFlushFixedLength(t *testing.T) {

r.SetBodyStream(buf, 3)

b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)

bw := &r
Expand Down Expand Up @@ -2786,8 +2785,7 @@ func TestResponseImmediateHeaderFlushFixedLengthSkipBody(t *testing.T) {

r.SetBodyStream(buf, 0)

b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)

var headersOnClose string
Expand Down Expand Up @@ -2821,8 +2819,7 @@ func TestResponseImmediateHeaderFlushChunked(t *testing.T) {

r.SetBodyStream(buf, -1)

b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)

bw := &r
Expand Down Expand Up @@ -2868,8 +2865,7 @@ func TestResponseImmediateHeaderFlushChunkedNoBody(t *testing.T) {

r.SetBodyStream(buf, -1)

b := []byte{}
w := bytes.NewBuffer(b)
w := &bytes.Buffer{}
bb := bufio.NewWriter(w)

var headersOnClose string
Expand Down

0 comments on commit 0be5a41

Please sign in to comment.