diff options
Diffstat (limited to 'src/pkg/reflect/all_test.go')
-rw-r--r-- | src/pkg/reflect/all_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pkg/reflect/all_test.go b/src/pkg/reflect/all_test.go index 5f0211c6a..3a1c220da 100644 --- a/src/pkg/reflect/all_test.go +++ b/src/pkg/reflect/all_test.go @@ -726,6 +726,25 @@ func TestChan(t *testing.T) { t.Errorf("TrySend 6, recv %d", i); } } + + // Close + c <- 123; + cv.Close(); + if cv.Closed() { + t.Errorf("closed too soon - 1"); + } + if i := cv.Recv().(*IntValue).Get(); i != 123 { + t.Errorf("send 123 then close; Recv %d", i); + } + if cv.Closed() { + t.Errorf("closed too soon - 2"); + } + if i := cv.Recv().(*IntValue).Get(); i != 0 { + t.Errorf("after close Recv %d", i); + } + if !cv.Closed() { + t.Errorf("not closed"); + } } // check creation of unbuffered channel |