Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 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 main | 5 package main |
6 | 6 |
7 func init() { | 7 func init() { |
8 addTestCases(urlTests) | 8 addTestCases(urlTests) |
dsymonds
2011/08/16 06:36:28
any worry about code like this?
type url string
rsc
2011/08/16 19:45:51
Won't that just work?
| |
9 } | 9 } |
10 | 10 |
11 var urlTests = []testCase{ | 11 var urlTests = []testCase{ |
12 { | 12 { |
13 Name: "url.0", | 13 Name: "url.0", |
14 In: `package main | 14 In: `package main |
15 | 15 |
16 import ( | 16 import ( |
17 "http" | 17 "http" |
18 ) | 18 ) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 In: `package main | 116 In: `package main |
117 | 117 |
118 import "http" | 118 import "http" |
119 | 119 |
120 type U struct{ url string } | 120 type U struct{ url string } |
121 | 121 |
122 func f() { | 122 func f() { |
123 var u U | 123 var u U |
124 u.url = "x" | 124 u.url = "x" |
125 } | 125 } |
126 | |
127 func (url *T) m() string { | |
128 return url | |
129 } | |
126 `, | 130 `, |
127 Out: `package main | 131 Out: `package main |
128 | 132 |
129 import "http" | 133 import "http" |
130 | 134 |
131 type U struct{ url string } | 135 type U struct{ url string } |
132 | 136 |
133 func f() { | 137 func f() { |
134 var u U | 138 var u U |
135 u.url = "x" | 139 u.url = "x" |
136 } | 140 } |
141 | |
142 func (url *T) m() string { | |
143 return url | |
144 } | |
137 `, | 145 `, |
138 }, | 146 }, |
139 } | 147 } |
LEFT | RIGHT |