Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(89)

Delta Between Two Patch Sets: src/pkg/compress/gzip/gzip_test.go

Issue 13435043: code review 13435043: compress/gzip: add Writer.Reset (Closed)
Left Patch Set: Created 10 years, 7 months ago
Right Patch Set: diff -r bf9de8d2e308 https://go.googlecode.com/hg/ Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/compress/gzip/gzip.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package gzip 5 package gzip
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "bytes" 9 "bytes"
10 "io/ioutil" 10 "io/ioutil"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 w = NewWriter(&buf) 207 w = NewWriter(&buf)
208 w.Write([]byte("world\n")) 208 w.Write([]byte("world\n"))
209 w.Close() 209 w.Close()
210 210
211 r, err := NewReader(&buf) 211 r, err := NewReader(&buf)
212 data, err := ioutil.ReadAll(r) 212 data, err := ioutil.ReadAll(r)
213 if string(data) != "hello world\n" || err != nil { 213 if string(data) != "hello world\n" || err != nil {
214 t.Fatalf("ReadAll = %q, %v, want %q, nil", data, err, "hello wor ld") 214 t.Fatalf("ReadAll = %q, %v, want %q, nil", data, err, "hello wor ld")
215 } 215 }
216 } 216 }
217
218 func TestWriterReset(t *testing.T) {
219 buf := new(bytes.Buffer)
220 buf2 := new(bytes.Buffer)
221 z := NewWriter(buf)
222 msg := []byte("hello world")
223 z.Write(msg)
224 z.Close()
225 z.Reset(buf2)
226 z.Write(msg)
227 z.Close()
228 if buf.String() != buf2.String() {
229 t.Errorf("buf2 %q != original buf of %q", buf2.String(), buf.Str ing())
230 }
231 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b