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

Function TestEncBuiltinMarshalInt32

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

Source from the content-addressed store, hash-verified

134}
135
136func TestEncBuiltinMarshalInt32(t *testing.T) {
137 s := RunServerOnPort(TEST_PORT)
138 defer s.Shutdown()
139
140 ec := NewDefaultEConn(t)
141 defer ec.Close()
142 ch := make(chan bool)
143
144 testN := 22
145
146 ec.Subscribe("enc_int", func(n int32) {
147 if n != int32(testN) {
148 t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
149 }
150 ch <- true
151 })
152 ec.Publish("enc_int", testN)
153 if e := Wait(ch); e != nil {
154 if ec.LastError() != nil {
155 e = ec.LastError()
156 }
157 t.Fatalf("Did not receive the message: %s", e)
158 }
159}
160
161func TestEncBuiltinMarshalInt64(t *testing.T) {
162 s := RunServerOnPort(TEST_PORT)

Callers

nothing calls this directly

Calls 8

NewDefaultEConnFunction · 0.85
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