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

Delta Between Two Patch Sets: src/pkg/go/typechecker/typechecker_test.go

Issue 4291070: code review 4291070: go/scanner: return literal as string instead of []byte (Closed)
Left Patch Set: diff -r f75a02fd83be https://go.googlecode.com/hg/ Created 13 years ago
Right Patch Set: diff -r 4073ecdfc054 https://go.googlecode.com/hg/ Created 13 years 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
« src/pkg/go/scanner/scanner.go ('K') | « src/pkg/go/scanner/scanner_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 // This file implements a simple typechecker test harness. Packages found 5 // This file implements a simple typechecker test harness. Packages found
6 // in the testDir directory are typechecked. Error messages reported by 6 // in the testDir directory are typechecked. Error messages reported by
7 // the typechecker are compared against the error messages expected for 7 // the typechecker are compared against the error messages expected for
8 // the test files. 8 // the test files.
9 // 9 //
10 // Expected errors are indicated in the test files by putting a comment 10 // Expected errors are indicated in the test files by putting a comment
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 file := fset.AddFile(filename, fset.Base(), len(src)) 71 file := fset.AddFile(filename, fset.Base(), len(src))
72 s.Init(file, src, nil, scanner.ScanComments) 72 s.Init(file, src, nil, scanner.ScanComments)
73 var prev token.Pos // position of last non-comment token 73 var prev token.Pos // position of last non-comment token
74 loop: 74 loop:
75 for { 75 for {
76 pos, tok, lit := s.Scan() 76 pos, tok, lit := s.Scan()
77 switch tok { 77 switch tok {
78 case token.EOF: 78 case token.EOF:
79 break loop 79 break loop
80 case token.COMMENT: 80 case token.COMMENT:
81 » » » » s := errRx.FindSubmatch(lit) 81 » » » » s := errRx.FindStringSubmatch(lit)
82 if len(s) == 2 { 82 if len(s) == 2 {
83 list = append(list, &scanner.Error{fset. Position(prev), string(s[1])}) 83 list = append(list, &scanner.Error{fset. Position(prev), string(s[1])})
84 } 84 }
85 default: 85 default:
86 prev = pos 86 prev = pos
87 } 87 }
88 } 88 }
89 } 89 }
90 sort.Sort(list) // multiple files may not be sorted 90 sort.Sort(list) // multiple files may not be sorted
91 return 91 return
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 t.Errorf("TypeCheck(%s): %d errors expec ted but %d reported", pkg.Name, len(xlist), len(elist)) 159 t.Errorf("TypeCheck(%s): %d errors expec ted but %d reported", pkg.Name, len(xlist), len(elist))
160 } 160 }
161 } else { 161 } else {
162 t.Errorf("TypeCheck(%s): %v", pkg.Name, err) 162 t.Errorf("TypeCheck(%s): %v", pkg.Name, err)
163 } 163 }
164 } else if len(xlist) > 0 { 164 } else if len(xlist) > 0 {
165 t.Errorf("TypeCheck(%s): %d errors expected but 0 report ed", pkg.Name, len(xlist)) 165 t.Errorf("TypeCheck(%s): %d errors expected but 0 report ed", pkg.Name, len(xlist))
166 } 166 }
167 } 167 }
168 } 168 }
LEFTRIGHT

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