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

Function TestEncBuiltinMarshalInt

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

Source from the content-addressed store, hash-verified

109}
110
111func TestEncBuiltinMarshalInt(t *testing.T) {
112 s := RunServerOnPort(TEST_PORT)
113 defer s.Shutdown()
114
115 ec := NewDefaultEConn(t)
116 defer ec.Close()
117 ch := make(chan bool)
118
119 testN := 22
120
121 ec.Subscribe("enc_int", func(n int) {
122 if n != testN {
123 t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
124 }
125 ch <- true
126 })
127 ec.Publish("enc_int", testN)
128 if e := Wait(ch); e != nil {
129 if ec.LastError() != nil {
130 e = ec.LastError()
131 }
132 t.Fatalf("Did not receive the message: %s", e)
133 }
134}
135
136func TestEncBuiltinMarshalInt32(t *testing.T) {
137 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