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

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

Issue 12387044: code review 12387044: compress/bzip2: support concatenated files (Closed)
Left Patch Set: Created 11 years, 7 months ago
Right Patch Set: diff -r f92a80e2ed16 https://code.google.com/p/go/ Created 11 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/bzip2/bzip2_test.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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 if err := w.Flush(); err != nil { 191 if err := w.Flush(); err != nil {
192 t.Fatal(err) 192 t.Fatal(err)
193 } 193 }
194 194
195 n3 := buf.Len() 195 n3 := buf.Len()
196 if n2 == n3 { 196 if n2 == n3 {
197 t.Fatal("Flush didn't flush any data") 197 t.Fatal("Flush didn't flush any data")
198 } 198 }
199 } 199 }
200
201 // Multiple gzip files concatenated form a valid gzip file.
202 func TestConcat(t *testing.T) {
203 var buf bytes.Buffer
204 w := NewWriter(&buf)
205 w.Write([]byte("hello "))
206 w.Close()
207 w = NewWriter(&buf)
208 w.Write([]byte("world\n"))
209 w.Close()
210
211 r, err := NewReader(&buf)
212 data, err := ioutil.ReadAll(r)
213 if string(data) != "hello world\n" || err != nil {
214 t.Fatalf("ReadAll = %q, %v, want %q, nil", data, err, "hello wor ld")
215 }
216 }
LEFTRIGHT

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