3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Test composite literals.
29 for i
:= 0; i
< len(a
); i
++ {
36 func teq(t
*T
, n
int) {
37 for i
:= 0; i
< n
; i
++ {
38 if t
== nil || t
.i
!= i
{
52 func NewP(a
, b
int) *P
{
58 t
= T
{0, 7.2, "hi", &t
}
61 tp
= &T
{0, 7.2, "hi", &t
}
63 tl
:= &T
{i
: 0, next
: &T
{i
: 1, next
: &T
{i
: 2, next
: &T
{i
: 3, next
: &T
{i
: 4}}}}}
70 a2
:= [10]int{1, 2, 3}
71 if len(a2
) != 10 ||
cap(a2
) != 10 {
75 a3
:= [10]int{1, 2, 3}
76 if len(a3
) != 10 || a2
[3] != 0 {
86 at
:= [...]*T
{&t
, tp
, &t
}
92 ac
:= []chan int{c
, c
, c
}
97 aat
:= [][len(at
)]*T
{at
, at
}
98 if len(aat
) != 2 ||
len(aat
[1]) != 3 {
102 s
:= string([]byte{'h', 'e', 'l', 'l', 'o'})
107 m
:= map[string]float64{"one": 1.0, "two": 2.0, "pi": 22. / 7.}
112 eq([]*R
{itor(0), itor(1), itor(2), itor(3), itor(4), itor(5)})
113 eq([]*R
{{0}, {1}, {2}, {3}, {4}, {5}})