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

Function TestEncBuiltinMarshalBytes

test/enc_test.go:86–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestEncBuiltinMarshalBytes(t *testing.T) {
87 s := RunServerOnPort(TEST_PORT)
88 defer s.Shutdown()
89
90 ec := NewDefaultEConn(t)
91 defer ec.Close()
92 ch := make(chan bool)
93
94 testBytes := []byte("Hello World!")
95
96 ec.Subscribe("enc_bytes", func(b []byte) {
97 if !bytes.Equal(b, testBytes) {
98 t.Fatalf("Received test bytes of '%s', wanted '%s'\n", b, testBytes)
99 }
100 ch <- true
101 })
102 ec.Publish("enc_bytes", testBytes)
103 if e := Wait(ch); e != nil {
104 if ec.LastError() != nil {
105 e = ec.LastError()
106 }
107 t.Fatalf("Did not receive the message: %s", e)
108 }
109}
110
111func TestEncBuiltinMarshalInt(t *testing.T) {
112 s := RunServerOnPort(TEST_PORT)

Callers

nothing calls this directly

Calls 9

NewDefaultEConnFunction · 0.85
EqualMethod · 0.80
FatalfMethod · 0.80
RunServerOnPortFunction · 0.70
WaitFunction · 0.70
SubscribeMethod · 0.65
PublishMethod · 0.65
CloseMethod · 0.45
LastErrorMethod · 0.45

Tested by

no test coverage detected