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

Side by Side Diff: src/pkg/html/parse_test.go

Issue 4357052: code review 4357052: os: New Open API. (Closed)
Patch Set: diff -r dc1d5042801a https://go.googlecode.com/hg/ Created 12 years, 12 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:
View unified diff | Download patch
OLDNEW
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 html 5 package html
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "bytes" 9 "bytes"
10 "fmt" 10 "fmt"
(...skipping 10 matching lines...) Expand all
21 return len(p), nil 21 return len(p), nil
22 } 22 }
23 23
24 func pipeErr(err os.Error) io.Reader { 24 func pipeErr(err os.Error) io.Reader {
25 pr, pw := io.Pipe() 25 pr, pw := io.Pipe()
26 pw.CloseWithError(err) 26 pw.CloseWithError(err)
27 return pr 27 return pr
28 } 28 }
29 29
30 func readDat(filename string, c chan io.Reader) { 30 func readDat(filename string, c chan io.Reader) {
31 » f, err := os.Open("testdata/webkit/"+filename, os.O_RDONLY, 0600) 31 » f, err := os.Open("testdata/webkit/" + filename)
32 if err != nil { 32 if err != nil {
33 c <- pipeErr(err) 33 c <- pipeErr(err)
34 return 34 return
35 } 35 }
36 defer f.Close() 36 defer f.Close()
37 37
38 // Loop through the lines of the file. Each line beginning with "#" deno tes 38 // Loop through the lines of the file. Each line beginning with "#" deno tes
39 // a new section, which is returned as a separate io.Reader. 39 // a new section, which is returned as a separate io.Reader.
40 r := bufio.NewReader(f) 40 r := bufio.NewReader(f)
41 var pw *io.PipeWriter 41 var pw *io.PipeWriter
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if err != nil { 149 if err != nil {
150 t.Fatal(err) 150 t.Fatal(err)
151 } 151 }
152 expected := string(b) 152 expected := string(b)
153 if actual != expected { 153 if actual != expected {
154 t.Errorf("%s test #%d %q, actual vs expected:\n- ---\n%s----\n%s----", filename, i, text, actual, expected) 154 t.Errorf("%s test #%d %q, actual vs expected:\n- ---\n%s----\n%s----", filename, i, text, actual, expected)
155 } 155 }
156 } 156 }
157 } 157 }
158 } 158 }
OLDNEW

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