| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Test struct-valued variables (not pointers). |
| type x2 struct { a,b,c int; d int; }; |
| var g2 struct { a,b,c int; d x2; }; |
| var s2 *struct { a,b,c int; d x2; }; |
| var s3 struct { a,b,c int; d x2; }; |
| if(s1.c != 3) { panic(s1.c); } |
| if(g1.c != 3) { panic(g1.c); } |
| if(s2.d.c != 23) { panic(s2.d.c); } |
| if(g2.d.c != 23) { panic(g2.d.c); } |
| if(x != 130) { panic(x); } |
| // test an automatic struct |
| if(s3.d.c != 23) { panic(s3.d.c); } |
| if(x != 119) { panic(x); } |