summaryrefslogtreecommitdiff
path: root/gcc/testsuite/go.test/test/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/go.test/test/syntax')
-rw-r--r--gcc/testsuite/go.test/test/syntax/chan.go17
-rw-r--r--gcc/testsuite/go.test/test/syntax/chan1.go17
-rw-r--r--gcc/testsuite/go.test/test/syntax/else.go12
-rw-r--r--gcc/testsuite/go.test/test/syntax/if.go18
-rw-r--r--gcc/testsuite/go.test/test/syntax/typesw.go13
5 files changed, 77 insertions, 0 deletions
diff --git a/gcc/testsuite/go.test/test/syntax/chan.go b/gcc/testsuite/go.test/test/syntax/chan.go
new file mode 100644
index 0000000000..ff3577502f
--- /dev/null
+++ b/gcc/testsuite/go.test/test/syntax/chan.go
@@ -0,0 +1,17 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2010 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 xyz struct {
+ ch chan
+} // ERROR "unexpected .*}.* in channel type"
+
+func Foo(y chan) { // ERROR "unexpected .*\).* in channel type"
+}
+
+func Bar(x chan, y int) { // ERROR "unexpected comma in channel type"
+}
diff --git a/gcc/testsuite/go.test/test/syntax/chan1.go b/gcc/testsuite/go.test/test/syntax/chan1.go
new file mode 100644
index 0000000000..9c12e5e6fe
--- /dev/null
+++ b/gcc/testsuite/go.test/test/syntax/chan1.go
@@ -0,0 +1,17 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2010 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
+
+var c chan int
+var v int
+
+func main() {
+ if c <- v { // ERROR "send statement.*value.*select"
+ }
+}
+
+var _ = c <- v // ERROR "send statement.*value.*select"
diff --git a/gcc/testsuite/go.test/test/syntax/else.go b/gcc/testsuite/go.test/test/syntax/else.go
new file mode 100644
index 0000000000..99595254fd
--- /dev/null
+++ b/gcc/testsuite/go.test/test/syntax/else.go
@@ -0,0 +1,12 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 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
+
+func main() {
+ if true {
+ } else ; // ERROR "else must be followed by if or statement block|expected .if. or .{."
+}
diff --git a/gcc/testsuite/go.test/test/syntax/if.go b/gcc/testsuite/go.test/test/syntax/if.go
new file mode 100644
index 0000000000..a3b51f0c07
--- /dev/null
+++ b/gcc/testsuite/go.test/test/syntax/if.go
@@ -0,0 +1,18 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 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
+
+func x() {
+}
+
+func main() {
+ if { // ERROR "missing condition"
+ }
+
+ if x(); { // ERROR "missing condition"
+ }
+}
diff --git a/gcc/testsuite/go.test/test/syntax/typesw.go b/gcc/testsuite/go.test/test/syntax/typesw.go
new file mode 100644
index 0000000000..47f683cdf2
--- /dev/null
+++ b/gcc/testsuite/go.test/test/syntax/typesw.go
@@ -0,0 +1,13 @@
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 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
+
+func main() {
+ switch main() := interface{}(nil).(type) { // ERROR "invalid variable name"
+ default:
+ }
+}