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

Delta Between Two Patch Sets: src/pkg/archive/tar/reader_test.go

Issue 6700047: code review 6700047: archive/tar: read/write extended pax/gnu tar archives (Closed)
Left Patch Set: diff -r 439cb8bad388 https://code.google.com/p/go Created 11 years, 1 month ago
Right Patch Set: diff -r 439cb8bad388 https://code.google.com/p/go Created 11 years, 1 month 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/archive/tar/reader.go ('k') | src/pkg/archive/tar/testdata/pax.tar » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 tar 5 package tar
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "crypto/md5" 9 "crypto/md5"
10 "fmt" 10 "fmt"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 func TestParsePAXHeader(t *testing.T) { 298 func TestParsePAXHeader(t *testing.T) {
299 paxTests := [][3]string{ 299 paxTests := [][3]string{
300 {"a", "a=name", "10 a=name\n"}, // Test case involving multiple acceptable lengths 300 {"a", "a=name", "10 a=name\n"}, // Test case involving multiple acceptable lengths
301 {"a", "a=name", "9 a=name\n"}, // Test case involving multiple acceptable length 301 {"a", "a=name", "9 a=name\n"}, // Test case involving multiple acceptable length
302 {"mtime", "mtime=1350244992.023960108", "30 mtime=1350244992.023 960108\n"}} 302 {"mtime", "mtime=1350244992.023960108", "30 mtime=1350244992.023 960108\n"}}
303 for _, test := range paxTests { 303 for _, test := range paxTests {
304 key, expected, raw := test[0], test[1], test[2] 304 key, expected, raw := test[0], test[1], test[2]
305 reader := bytes.NewBuffer([]byte(raw)) 305 reader := bytes.NewBuffer([]byte(raw))
306 headers, err := parsePAX(reader) 306 headers, err := parsePAX(reader)
307 if err != nil { 307 if err != nil {
308 » » » t.Errorf("Couldn't parse correctly formatted headers %v" , err) 308 » » » t.Errorf("Couldn't parse correctly formatted headers: %v ", err)
309 continue 309 continue
310 } 310 }
311 if strings.EqualFold(headers[key], expected) { 311 if strings.EqualFold(headers[key], expected) {
312 t.Errorf("mtime header incorrectly parsed: got %s, wante d %s", headers[key], expected) 312 t.Errorf("mtime header incorrectly parsed: got %s, wante d %s", headers[key], expected)
313 continue 313 continue
314 } 314 }
315 trailer := make([]byte, 100) 315 trailer := make([]byte, 100)
316 n, err := reader.Read(trailer) 316 n, err := reader.Read(trailer)
317 if err != io.EOF || n != 0 { 317 if err != io.EOF || n != 0 {
318 t.Error("Buffer wasn't consumed") 318 t.Error("Buffer wasn't consumed")
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 want := &Header{ 358 want := &Header{
359 Name: "a/b/c", 359 Name: "a/b/c",
360 Uid: 1000, 360 Uid: 1000,
361 ModTime: time.Unix(1350244992, 23960108), 361 ModTime: time.Unix(1350244992, 23960108),
362 } 362 }
363 if !reflect.DeepEqual(hdr, want) { 363 if !reflect.DeepEqual(hdr, want) {
364 t.Errorf("incorrect merge: got %+v, want %+v", hdr, want) 364 t.Errorf("incorrect merge: got %+v, want %+v", hdr, want)
365 } 365 }
366 } 366 }
LEFTRIGHT

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