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

Delta Between Two Patch Sets: src/cmd/api/goapi_test.go

Issue 12300043: code review 12300043: cmd/api: rewrite using go/types (Closed)
Left Patch Set: diff -r 564e8c77a065 https://code.google.com/p/go Created 11 years, 7 months ago
Right Patch Set: diff -r f53cee5f15de 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/cmd/api/goapi.go ('k') | src/cmd/api/testdata/src/pkg/p1/golden.txt » ('j') | 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 // +build api_tool
2
1 // Copyright 2011 The Go Authors. All rights reserved. 3 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 4 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 5 // license that can be found in the LICENSE file.
4 6
5 package main 7 package main
6 8
7 import ( 9 import (
8 "bytes" 10 "bytes"
9 "flag" 11 "flag"
10 "fmt" 12 "fmt"
(...skipping 15 matching lines...) Expand all
26 t.Fatal(err) 28 t.Fatal(err)
27 } 29 }
28 fis, err := td.Readdir(0) 30 fis, err := td.Readdir(0)
29 if err != nil { 31 if err != nil {
30 t.Fatal(err) 32 t.Fatal(err)
31 } 33 }
32 for _, fi := range fis { 34 for _, fi := range fis {
33 if !fi.IsDir() { 35 if !fi.IsDir() {
34 continue 36 continue
35 } 37 }
36 w := NewWalker()
37 w.wantedPkg[fi.Name()] = true
38 38
39 w.root = "testdata/src/pkg"
40 goldenFile := filepath.Join("testdata", "src", "pkg", fi.Name(), "golden.txt") 39 goldenFile := filepath.Join("testdata", "src", "pkg", fi.Name(), "golden.txt")
41 » » w.WalkPackage(fi.Name()) 40 » » w := NewWalker(nil, "testdata/src/pkg")
41 » » w.export(w.Import(fi.Name()))
42 42
43 if *updateGolden { 43 if *updateGolden {
44 os.Remove(goldenFile) 44 os.Remove(goldenFile)
45 f, err := os.Create(goldenFile) 45 f, err := os.Create(goldenFile)
46 if err != nil { 46 if err != nil {
47 t.Fatal(err) 47 t.Fatal(err)
48 } 48 }
49 for _, feat := range w.Features() { 49 for _, feat := range w.Features() {
50 fmt.Fprintf(f, "%s\n", feat) 50 fmt.Fprintf(f, "%s\n", feat)
51 } 51 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 buf := new(bytes.Buffer) 132 buf := new(bytes.Buffer)
133 gotok := compareAPI(buf, tt.features, tt.required, tt.optional, tt.exception) 133 gotok := compareAPI(buf, tt.features, tt.required, tt.optional, tt.exception)
134 if gotok != tt.ok { 134 if gotok != tt.ok {
135 t.Errorf("%s: ok = %v; want %v", tt.name, gotok, tt.ok) 135 t.Errorf("%s: ok = %v; want %v", tt.name, gotok, tt.ok)
136 } 136 }
137 if got := buf.String(); got != tt.out { 137 if got := buf.String(); got != tt.out {
138 t.Errorf("%s: output differs\nGOT:\n%s\nWANT:\n%s", tt.n ame, got, tt.out) 138 t.Errorf("%s: output differs\nGOT:\n%s\nWANT:\n%s", tt.n ame, got, tt.out)
139 } 139 }
140 } 140 }
141 } 141 }
LEFTRIGHT

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