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

Side by Side Diff: src/pkg/xml/read_test.go

Issue 4301043: update tree for reflect changes (Closed)
Patch Set: diff -r f692a5e90f6f 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/xml/read.go ('k') | test/fixedbugs/bug177.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 xml 5 package xml
6 6
7 import ( 7 import (
8 "reflect" 8 "reflect"
9 "testing" 9 "testing"
10 ) 10 )
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 var pathTests = []interface{}{ 282 var pathTests = []interface{}{
283 &PathTestA{Items: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"} , 283 &PathTestA{Items: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"} ,
284 &PathTestB{Other: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"} , 284 &PathTestB{Other: []PathTestItem{{"A"}, {"D"}}, Before: "1", After: "2"} ,
285 &PathTestC{Values1: []string{"A", "C", "D"}, Values2: []string{"B"}, Bef ore: "1", After: "2"}, 285 &PathTestC{Values1: []string{"A", "C", "D"}, Values2: []string{"B"}, Bef ore: "1", After: "2"},
286 &PathTestD{Other: PathTestSet{Item1: []PathTestItem{{"A"}, {"D"}}}, Befo re: "1", After: "2"}, 286 &PathTestD{Other: PathTestSet{Item1: []PathTestItem{{"A"}, {"D"}}}, Befo re: "1", After: "2"},
287 } 287 }
288 288
289 func TestUnmarshalPaths(t *testing.T) { 289 func TestUnmarshalPaths(t *testing.T) {
290 for _, pt := range pathTests { 290 for _, pt := range pathTests {
291 p := reflect.MakeZero(reflect.NewValue(pt).Type()).(*reflect.Ptr Value) 291 p := reflect.MakeZero(reflect.NewValue(pt).Type()).(*reflect.Ptr Value)
292 » » p.PointTo(reflect.MakeZero(p.Type().(*reflect.PtrType).Elem())) 292 » » p.PointTo(reflect.MakeZero(p.Type().Elem()))
293 v := p.Interface() 293 v := p.Interface()
294 if err := Unmarshal(StringReader(pathTestString), v); err != nil { 294 if err := Unmarshal(StringReader(pathTestString), v); err != nil {
295 t.Fatalf("Unmarshal: %s", err) 295 t.Fatalf("Unmarshal: %s", err)
296 } 296 }
297 if !reflect.DeepEqual(v, pt) { 297 if !reflect.DeepEqual(v, pt) {
298 t.Fatalf("have %#v\nwant %#v", v, pt) 298 t.Fatalf("have %#v\nwant %#v", v, pt)
299 } 299 }
300 } 300 }
301 } 301 }
302 302
(...skipping 17 matching lines...) Expand all
320 } 320 }
321 321
322 func TestUnmarshalBadPaths(t *testing.T) { 322 func TestUnmarshalBadPaths(t *testing.T) {
323 for _, tt := range badPathTests { 323 for _, tt := range badPathTests {
324 err := Unmarshal(StringReader(pathTestString), tt.v) 324 err := Unmarshal(StringReader(pathTestString), tt.v)
325 if !reflect.DeepEqual(err, tt.e) { 325 if !reflect.DeepEqual(err, tt.e) {
326 t.Fatalf("Unmarshal with %#v didn't fail properly: %#v", tt.v, err) 326 t.Fatalf("Unmarshal with %#v didn't fail properly: %#v", tt.v, err)
327 } 327 }
328 } 328 }
329 } 329 }
OLDNEW
« no previous file with comments | « src/pkg/xml/read.go ('k') | test/fixedbugs/bug177.go » ('j') | no next file with comments »

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