(t *testing.T)
| 151 | } |
| 152 | |
| 153 | func TestSimpleRecvChan(t *testing.T) { |
| 154 | s := RunDefaultServer() |
| 155 | defer s.Shutdown() |
| 156 | |
| 157 | ec := NewEConn(t) |
| 158 | defer ec.Close() |
| 159 | |
| 160 | numSent := int32(22) |
| 161 | ch := make(chan int32) |
| 162 | |
| 163 | if _, err := ec.BindRecvChan("foo", ch); err != nil { |
| 164 | t.Fatalf("Failed to bind to a receive channel: %v\n", err) |
| 165 | } |
| 166 | |
| 167 | ec.Publish("foo", numSent) |
| 168 | |
| 169 | // Receive from 'foo' |
| 170 | select { |
| 171 | case num := <-ch: |
| 172 | if num != numSent { |
| 173 | t.Fatalf("Failed to receive correct value: %d vs %d\n", num, numSent) |
| 174 | } |
| 175 | case <-time.After(1 * time.Second): |
| 176 | t.Fatalf("Failed to receive a value, timed-out\n") |
| 177 | } |
| 178 | close(ch) |
| 179 | } |
| 180 | |
| 181 | func TestQueueRecvChan(t *testing.T) { |
| 182 | s := RunDefaultServer() |
nothing calls this directly
no test coverage detected