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

Delta Between Two Patch Sets: src/pkg/mime/multipart/writer_test.go

Issue 4635063: code review 4635063: mime/multipart: remove newline at top of the multipart. (Closed)
Left Patch Set: diff -r 57985f90a7d8 http://go.googlecode.com/hg/ Created 12 years, 9 months ago
Right Patch Set: diff -r 994436b726dd https://go.googlecode.com/hg/ Created 12 years, 9 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/mime/multipart/writer.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 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 multipart 5 package multipart
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "io/ioutil" 9 "io/ioutil"
10 "testing" 10 "testing"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 part.Write(fileContents) 23 part.Write(fileContents)
24 err = w.WriteField("key", "val") 24 err = w.WriteField("key", "val")
25 if err != nil { 25 if err != nil {
26 t.Fatalf("WriteField: %v", err) 26 t.Fatalf("WriteField: %v", err)
27 } 27 }
28 part.Write([]byte("val")) 28 part.Write([]byte("val"))
29 err = w.Close() 29 err = w.Close()
30 if err != nil { 30 if err != nil {
31 t.Fatalf("Close: %v", err) 31 t.Fatalf("Close: %v", err)
32 }
33 s := b.String()
34 if len(s) == 0 {
35 t.Fatal("String: unexpected empty result")
36 }
37 if s[0] == '\r' || s[0] == '\n' {
38 t.Fatal("String: unexpected newline")
32 } 39 }
33 } 40 }
34 41
35 r := NewReader(&b, w.Boundary()) 42 r := NewReader(&b, w.Boundary())
36 43
37 part, err := r.NextPart() 44 part, err := r.NextPart()
38 if err != nil { 45 if err != nil {
39 t.Fatalf("part 1: %v", err) 46 t.Fatalf("part 1: %v", err)
40 } 47 }
41 if g, e := part.FormName(), "myfile"; g != e { 48 if g, e := part.FormName(), "myfile"; g != e {
(...skipping 20 matching lines...) Expand all
62 } 69 }
63 if e, g := "val", string(slurp); e != g { 70 if e, g := "val", string(slurp); e != g {
64 t.Errorf("part 2: want contents %q, got %q", e, g) 71 t.Errorf("part 2: want contents %q, got %q", e, g)
65 } 72 }
66 73
67 part, err = r.NextPart() 74 part, err = r.NextPart()
68 if part != nil || err == nil { 75 if part != nil || err == nil {
69 t.Fatalf("expected end of parts; got %v, %v", part, err) 76 t.Fatalf("expected end of parts; got %v, %v", part, err)
70 } 77 }
71 } 78 }
LEFTRIGHT

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