summaryrefslogtreecommitdiff
path: root/test/initializerr.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-09-13 13:13:40 +0200
committerOndřej Surý <ondrej@sury.org>2011-09-13 13:13:40 +0200
commit5ff4c17907d5b19510a62e08fd8d3b11e62b431d (patch)
treec0650497e988f47be9c6f2324fa692a52dea82e1 /test/initializerr.go
parent80f18fc933cf3f3e829c5455a1023d69f7b86e52 (diff)
downloadgolang-upstream/60.tar.gz
Imported Upstream version 60upstream/60
Diffstat (limited to 'test/initializerr.go')
-rw-r--r--test/initializerr.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/initializerr.go b/test/initializerr.go
new file mode 100644
index 000000000..e7f8b0e92
--- /dev/null
+++ b/test/initializerr.go
@@ -0,0 +1,25 @@
+// errchk $G -e $D/$F.go
+
+// 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.
+
+package main
+
+type S struct {
+ A, B, C, X, Y, Z int
+}
+
+type T struct {
+ S
+}
+
+var x = 1
+var a1 = S { 0, X: 1 } // ERROR "mixture|undefined"
+var a2 = S { Y: 3, Z: 2, Y: 3 } // ERROR "duplicate"
+var a3 = T { S{}, 2, 3, 4, 5, 6 } // ERROR "convert|too many"
+var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index|too many"
+var a5 = []byte { x: 2 } // ERROR "index"
+
+var ok1 = S { } // should be ok
+var ok2 = T { S: ok1 } // should be ok