diff options
| author | Ian Lance Taylor <iant@golang.org> | 2008-11-06 15:24:10 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2008-11-06 15:24:10 -0800 |
| commit | ce15158502dad699a4781908a2fb0bed1dc8b61b (patch) | |
| tree | 4a2a41286c9a1178b216f4b0f1c9bc1909d5635d | |
| parent | ec81145565af06164c31bb83532eb11f48198a0b (diff) | |
| download | go-ce15158502dad699a4781908a2fb0bed1dc8b61b.tar.xz | |
Test that a break statement inside a select statement breaks
out of the enclosing loop.
R=ken
DELTA=20 (20 added, 0 deleted, 0 changed)
OCL=18686
CL=18714
| -rw-r--r-- | test/bugs/bug119.go | 20 | ||||
| -rw-r--r-- | test/golden.out | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/bugs/bug119.go b/test/bugs/bug119.go new file mode 100644 index 0000000000..956f1b95d4 --- /dev/null +++ b/test/bugs/bug119.go @@ -0,0 +1,20 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should not fail + +// 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 + +func main() { + a := new(chan bool); + for { + select { + case <- a: + panic(); + default: + break; + } + panic(); + } +} diff --git a/test/golden.out b/test/golden.out index 640267d301..77fe8dc881 100644 --- a/test/golden.out +++ b/test/golden.out @@ -153,6 +153,10 @@ BUG: should compile =========== bugs/bug118.go BUG should compile +=========== bugs/bug119.go + +panic on line 82 PC=xxx +BUG should not panic =========== fixedbugs/bug016.go fixedbugs/bug016.go:7: overflow converting constant to uint |
