(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func TestSimpleSendChan(t *testing.T) { |
| 59 | s := RunDefaultServer() |
| 60 | defer s.Shutdown() |
| 61 | |
| 62 | ec := NewEConn(t) |
| 63 | defer ec.Close() |
| 64 | |
| 65 | recv := make(chan bool) |
| 66 | |
| 67 | numSent := int32(22) |
| 68 | ch := make(chan int32) |
| 69 | |
| 70 | if err := ec.BindSendChan("foo", ch); err != nil { |
| 71 | t.Fatalf("Failed to bind to a send channel: %v\n", err) |
| 72 | } |
| 73 | |
| 74 | ec.Subscribe("foo", func(num int32) { |
| 75 | if num != numSent { |
| 76 | t.Fatalf("Failed to receive correct value: %d vs %d\n", num, numSent) |
| 77 | } |
| 78 | recv <- true |
| 79 | }) |
| 80 | |
| 81 | // Send to 'foo' |
| 82 | ch <- numSent |
| 83 | |
| 84 | if e := Wait(recv); e != nil { |
| 85 | if ec.LastError() != nil { |
| 86 | e = ec.LastError() |
| 87 | } |
| 88 | t.Fatalf("Did not receive the message: %s", e) |
| 89 | } |
| 90 | close(ch) |
| 91 | } |
| 92 | |
| 93 | func TestFailedChannelSend(t *testing.T) { |
| 94 | s := RunDefaultServer() |
nothing calls this directly
no test coverage detected