add Close() and Closed() to ChanValue
R=r
DELTA=60 (56 added, 3 deleted, 1 changed)
OCL=33868
CL=33872
diff --git a/src/pkg/reflect/all_test.go b/src/pkg/reflect/all_test.go
index 5f0211c..3a1c220 100644
--- a/src/pkg/reflect/all_test.go
+++ b/src/pkg/reflect/all_test.go
@@ -726,6 +726,25 @@
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