MCPcopy
hub / github.com/nats-io/nats.go / TestBadChan

Function TestBadChan

test/netchan_test.go:34–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestBadChan(t *testing.T) {
35 s := RunDefaultServer()
36 defer s.Shutdown()
37
38 ec := NewEConn(t)
39 defer ec.Close()
40
41 if err := ec.BindSendChan("foo", "not a chan"); err == nil {
42 t.Fatalf("Expected an Error when sending a non-channel\n")
43 }
44
45 if _, err := ec.BindRecvChan("foo", "not a chan"); err == nil {
46 t.Fatalf("Expected an Error when sending a non-channel\n")
47 }
48
49 if err := ec.BindSendChan("foo", "not a chan"); err != nats.ErrChanArg {
50 t.Fatalf("Expected an ErrChanArg when sending a non-channel\n")
51 }
52
53 if _, err := ec.BindRecvChan("foo", "not a chan"); err != nats.ErrChanArg {
54 t.Fatalf("Expected an ErrChanArg when sending a non-channel\n")
55 }
56}
57
58func TestSimpleSendChan(t *testing.T) {
59 s := RunDefaultServer()

Callers

nothing calls this directly

Calls 6

NewEConnFunction · 0.85
BindSendChanMethod · 0.80
FatalfMethod · 0.80
BindRecvChanMethod · 0.80
RunDefaultServerFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected