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

Delta Between Two Patch Sets: decode_test.go

Issue 5503044: Fix map initialization.
Left Patch Set: Fix map initialization. Created 12 years, 3 months ago
Right Patch Set: Fix map initialization. Created 12 years, 3 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « decode.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
1 package goyaml_test 1 package goyaml_test
2 2
3 import ( 3 import (
4 . "launchpad.net/gocheck" 4 . "launchpad.net/gocheck"
5 "launchpad.net/goyaml" 5 "launchpad.net/goyaml"
6 "math" 6 "math"
7 "reflect" 7 "reflect"
8 ) 8 )
9 9
10 var unmarshalIntTest = 123 10 var unmarshalIntTest = 123
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 // Map inside interface with no type hints. 78 // Map inside interface with no type hints.
79 {"a: {b: c}", 79 {"a: {b: c}",
80 map[string]interface{}{"a": map[interface{}]interface{}{"b": "c" }}}, 80 map[string]interface{}{"a": map[interface{}]interface{}{"b": "c" }}},
81 81
82 // Structs and type conversions. 82 // Structs and type conversions.
83 {"hello: world", &struct{ Hello string }{"world"}}, 83 {"hello: world", &struct{ Hello string }{"world"}},
84 {"a: {b: c}", &struct{ A struct{ B string } }{struct{ B string }{"c"}}}, 84 {"a: {b: c}", &struct{ A struct{ B string } }{struct{ B string }{"c"}}},
85 {"a: {b: c}", &struct{ A *struct{ B string } }{&struct{ B string }{"c"}} }, 85 {"a: {b: c}", &struct{ A *struct{ B string } }{&struct{ B string }{"c"}} },
86 {"a: {b: c}", &struct{ A map[string]string }{map[string]string{"b": "c"} }}, 86 {"a: {b: c}", &struct{ A map[string]string }{map[string]string{"b": "c"} }},
87 {"a: {b: c}", &struct{ A *map[string]string }{&map[string]string{"b": "c "}}},
87 {"a: 1", &struct{ A int }{1}}, 88 {"a: 1", &struct{ A int }{1}},
88 {"a: [1, 2]", &struct{ A []int }{[]int{1, 2}}}, 89 {"a: [1, 2]", &struct{ A []int }{[]int{1, 2}}},
89 {"a: 1", &struct{ B int }{0}}, 90 {"a: 1", &struct{ B int }{0}},
90 {"a: 1", &struct { 91 {"a: 1", &struct {
91 B int "a" 92 B int "a"
92 }{1}}, 93 }{1}},
93 {"a: y", &struct{ A bool }{true}}, 94 {"a: y", &struct{ A bool }{true}},
94 95
95 // Some cross type conversions 96 // Some cross type conversions
96 {"v: 42", map[string]uint{"v": 42}}, 97 {"v: 42", map[string]uint{"v": 42}},
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 err := goyaml.Unmarshal([]byte(data), m) 226 err := goyaml.Unmarshal([]byte(data), m)
226 c.Assert(err, IsNil) 227 c.Assert(err, IsNil)
227 c.Assert(m["abc"], NotNil) 228 c.Assert(m["abc"], NotNil)
228 c.Assert(m["def"], IsNil) 229 c.Assert(m["def"], IsNil)
229 c.Assert(m["ghi"], NotNil) 230 c.Assert(m["ghi"], NotNil)
230 c.Assert(m["jkl"], IsNil) 231 c.Assert(m["jkl"], IsNil)
231 232
232 c.Assert(m["abc"].value, Equals, 1) 233 c.Assert(m["abc"].value, Equals, 1)
233 c.Assert(m["ghi"].value, Equals, 3) 234 c.Assert(m["ghi"].value, Equals, 3)
234 } 235 }
LEFTRIGHT
« decode.go ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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