summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShenghou Ma <minux@golang.org>2014-07-18 20:59:55 -0400
committerShenghou Ma <minux@golang.org>2014-07-18 20:59:55 -0400
commit80e2eb1beab7e48d78292f956ed1dbb4f9b78e50 (patch)
tree2a114073132bb9fb64a8956180d32ab74ee1514c /test
parent0224e7bc3b017547e2e97aad24e9fe2d5366f651 (diff)
downloadgo-80e2eb1beab7e48d78292f956ed1dbb4f9b78e50.tar.gz
test: add test for issue8347
Fixes issue 8347. LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://codereview.appspot.com/109600044
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue8347.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/fixedbugs/issue8347.go b/test/fixedbugs/issue8347.go
new file mode 100644
index 000000000..0828ccf06
--- /dev/null
+++ b/test/fixedbugs/issue8347.go
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2014 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() {
+ c := make(chan bool, 1)
+ ok := true
+ for i := 0; i < 12; i++ {
+ select {
+ case _, ok = <-c:
+ if i < 10 && !ok {
+ panic("BUG")
+ }
+ default:
+ }
+ if i < 10 && !ok {
+ panic("BUG")
+ }
+ if i >= 10 && ok {
+ close(c)
+ }
+ }
+}