(t *testing.T)
| 234 | } |
| 235 | |
| 236 | func TestEncBuiltinMarshalBool(t *testing.T) { |
| 237 | s := RunServerOnPort(TEST_PORT) |
| 238 | defer s.Shutdown() |
| 239 | |
| 240 | ec := NewDefaultEConn(t) |
| 241 | defer ec.Close() |
| 242 | ch := make(chan bool) |
| 243 | expected := make(chan bool, 1) |
| 244 | |
| 245 | ec.Subscribe("enc_bool", func(b bool) { |
| 246 | val := <-expected |
| 247 | if b != val { |
| 248 | t.Fatal("Boolean values did not match") |
| 249 | } |
| 250 | ch <- true |
| 251 | }) |
| 252 | |
| 253 | expected <- false |
| 254 | ec.Publish("enc_bool", false) |
| 255 | if e := Wait(ch); e != nil { |
| 256 | if ec.LastError() != nil { |
| 257 | e = ec.LastError() |
| 258 | } |
| 259 | t.Fatalf("Did not receive the message: %s", e) |
| 260 | } |
| 261 | |
| 262 | expected <- true |
| 263 | ec.Publish("enc_bool", true) |
| 264 | if e := Wait(ch); e != nil { |
| 265 | if ec.LastError() != nil { |
| 266 | e = ec.LastError() |
| 267 | } |
| 268 | t.Fatalf("Did not receive the message: %s", e) |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | func TestEncBuiltinExtendedSubscribeCB(t *testing.T) { |
| 273 | s := RunServerOnPort(TEST_PORT) |
nothing calls this directly
no test coverage detected