summaryrefslogtreecommitdiff
path: root/test/chan
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-01-21 15:07:13 -0500
committerRuss Cox <rsc@golang.org>2011-01-21 15:07:13 -0500
commit3762d3b6e52dc449167faff2adebe090d0491506 (patch)
treefca1c43905617819612193fa3a742c33c396b990 /test/chan
parent2f0305d44a17fd9a4cf2ec6b6708d67c44f2a82e (diff)
downloadgo-3762d3b6e52dc449167faff2adebe090d0491506.tar.gz
spec, runtime, tests: send on closed channel panics
Close of closed channel panics. Receive from closed channel never panics, even if done repeatedly. Fixes issue 1349. Fixes issue 1419. R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry CC=golang-dev http://codereview.appspot.com/3989042
Diffstat (limited to 'test/chan')
-rw-r--r--test/chan/select3.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/test/chan/select3.go b/test/chan/select3.go
index a1a2ef50b..9877b12a9 100644
--- a/test/chan/select3.go
+++ b/test/chan/select3.go
@@ -97,13 +97,9 @@ func main() {
}
})
- // sending (a small number of times) to a closed channel is not specified
- // but the current implementation doesn't block: test that different
- // implementations behave the same
- testBlock(never, func() {
- for i := 0; i < 10; i++ {
- closedch <- 7
- }
+ // sending to a closed channel panics.
+ testPanic(always, func() {
+ closedch <- 7
})
// receiving from a non-ready channel always blocks
@@ -189,13 +185,13 @@ func main() {
}
})
- // selects with closed channels don't block
+ // selects with closed channels behave like ordinary operations
testBlock(never, func() {
select {
case <-closedch:
}
})
- testBlock(never, func() {
+ testPanic(always, func() {
select {
case closedch <- 7:
}