finish ChanValue: Len and Cap.

R=r
DELTA=45  (45 added, 0 deleted, 0 changed)
OCL=33873
CL=33881
This commit is contained in:
Russ Cox 2009-08-26 12:42:22 -07:00
parent 653cef1ba0
commit de7920e6fd
5 changed files with 45 additions and 0 deletions

View file

@ -757,6 +757,17 @@ func TestChan(t *testing.T) {
if cv.TryRecv() != nil {
t.Errorf("TryRecv on sync chan succeeded");
}
// len/cap
cv = MakeChan(Typeof(c).(*ChanType), 10);
c = cv.Interface().(chan int);
for i := 0; i < 3; i++ {
c <- i;
}
if l, m := cv.Len(), cv.Cap(); l != len(c) || m != cap(c) {
t.Errorf("Len/Cap = %d/%d want %d/%d", l, m, len(c), cap(c));
}
}
// Difficult test for function call because of