aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/libgo/go/go/parser/short_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8.1/libgo/go/go/parser/short_test.go')
-rw-r--r--gcc-4.8.1/libgo/go/go/parser/short_test.go80
1 files changed, 0 insertions, 80 deletions
diff --git a/gcc-4.8.1/libgo/go/go/parser/short_test.go b/gcc-4.8.1/libgo/go/go/parser/short_test.go
deleted file mode 100644
index c62f7e050..000000000
--- a/gcc-4.8.1/libgo/go/go/parser/short_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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.
-
-// This file contains test cases for short valid and invalid programs.
-
-package parser
-
-import "testing"
-
-var valids = []string{
- "package p\n",
- `package p;`,
- `package p; import "fmt"; func f() { fmt.Println("Hello, World!") };`,
- `package p; func f() { if f(T{}) {} };`,
- `package p; func f() { _ = <-chan int(nil) };`,
- `package p; func f() { _ = (<-chan int)(nil) };`,
- `package p; func f() { _ = (<-chan <-chan int)(nil) };`,
- `package p; func f() { _ = <-chan <-chan <-chan <-chan <-int(nil) };`,
- `package p; func f(func() func() func());`,
- `package p; func f(...T);`,
- `package p; func f(float, ...int);`,
- `package p; func f(x int, a ...int) { f(0, a...); f(1, a...,) };`,
- `package p; func f(int,) {};`,
- `package p; func f(...int,) {};`,
- `package p; func f(x ...int,) {};`,
- `package p; type T []int; var a []bool; func f() { if a[T{42}[0]] {} };`,
- `package p; type T []int; func g(int) bool { return true }; func f() { if g(T{42}[0]) {} };`,
- `package p; type T []int; func f() { for _ = range []int{T{42}[0]} {} };`,
- `package p; var a = T{{1, 2}, {3, 4}}`,
- `package p; func f() { select { case <- c: case c <- d: case c <- <- d: case <-c <- d: } };`,
- `package p; func f() { select { case x := (<-c): } };`,
- `package p; func f() { if ; true {} };`,
- `package p; func f() { switch ; {} };`,
- `package p; func f() { for _ = range "foo" + "bar" {} };`,
-}
-
-func TestValid(t *testing.T) {
- for _, src := range valids {
- checkErrors(t, src, src)
- }
-}
-
-var invalids = []string{
- `foo /* ERROR "expected 'package'" */ !`,
- `package p; func f() { if { /* ERROR "expected operand" */ } };`,
- `package p; func f() { if ; { /* ERROR "expected operand" */ } };`,
- `package p; func f() { if f(); { /* ERROR "expected operand" */ } };`,
- `package p; const c; /* ERROR "expected '='" */`,
- `package p; func f() { if _ /* ERROR "expected condition" */ = range x; true {} };`,
- `package p; func f() { switch _ /* ERROR "expected condition" */ = range x; true {} };`,
- `package p; func f() { for _ = range x ; /* ERROR "expected '{'" */ ; {} };`,
- `package p; func f() { for ; ; _ = range /* ERROR "expected operand" */ x {} };`,
- `package p; func f() { for ; _ /* ERROR "expected condition" */ = range x ; {} };`,
- `package p; func f() { switch t /* ERROR "expected condition" */ = t.(type) {} };`,
- `package p; func f() { switch t /* ERROR "expected condition" */ , t = t.(type) {} };`,
- `package p; func f() { switch t /* ERROR "expected condition" */ = t.(type), t {} };`,
- `package p; var a = [ /* ERROR "expected expression" */ 1]int;`,
- `package p; var a = [ /* ERROR "expected expression" */ ...]int;`,
- `package p; var a = struct /* ERROR "expected expression" */ {}`,
- `package p; var a = func /* ERROR "expected expression" */ ();`,
- `package p; var a = interface /* ERROR "expected expression" */ {}`,
- `package p; var a = [ /* ERROR "expected expression" */ ]int`,
- `package p; var a = map /* ERROR "expected expression" */ [int]int`,
- `package p; var a = chan /* ERROR "expected expression" */ int;`,
- `package p; var a = []int{[ /* ERROR "expected expression" */ ]int};`,
- `package p; var a = ( /* ERROR "expected expression" */ []int);`,
- `package p; var a = a[[ /* ERROR "expected expression" */ ]int:[]int];`,
- `package p; var a = <- /* ERROR "expected expression" */ chan int;`,
- `package p; func f() { select { case _ <- chan /* ERROR "expected expression" */ int: } };`,
- `package p; func f() { _ = (<-<- /* ERROR "expected 'chan'" */ chan int)(nil) };`,
- `package p; func f() { _ = (<-chan<-chan<-chan<-chan<-chan<- /* ERROR "expected channel type" */ int)(nil) };`,
- `package p; func f() { var t []int; t /* ERROR "expected identifier on left side of :=" */ [0] := 0 };`,
-}
-
-func TestInvalid(t *testing.T) {
- for _, src := range invalids {
- checkErrors(t, src, src)
- }
-}