aboutsummaryrefslogtreecommitdiff
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
commit27c74d3499b12288fb4a944ce5376820dee1c8b1 (patch)
tree908644fb4876269c4ba977d120e48e796c17b9bb /test/chan
parent0a5fc261b65aff5c66033eb22edd6f7acd4f6bbd (diff)
downloadgo-27c74d3499b12288fb4a944ce5376820dee1c8b1.tar.gz
go-27c74d3499b12288fb4a944ce5376820dee1c8b1.zip
spec, runtime, tests: send on closed channel panics
Close of closed channel panics. Receive from closed channel never panics, even if done repeatedly. Fixes #1349. Fixes #1419. R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry CC=golang-dev https://golang.org/cl/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 a1a2ef50b5..9877b12a98 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:
}