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

Function TestEncBuiltinGobMarshalInt

test/gob_test.go:55–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestEncBuiltinGobMarshalInt(t *testing.T) {
56 s := RunServerOnPort(TEST_PORT)
57 defer s.Shutdown()
58
59 ec := NewGobEncodedConn(t)
60 defer ec.Close()
61 ch := make(chan bool)
62
63 testN := 22
64
65 ec.Subscribe("gob_int", func(n int) {
66 if n != testN {
67 t.Fatalf("Received test int of '%d', wanted '%d'\n", n, testN)
68 }
69 ch <- true
70 })
71 ec.Publish("gob_int", testN)
72 if e := Wait(ch); e != nil {
73 t.Fatal("Did not receive the message")
74 }
75}
76
77func TestEncBuiltinGobMarshalStruct(t *testing.T) {
78 s := RunServerOnPort(TEST_PORT)

Callers

nothing calls this directly

Calls 7

NewGobEncodedConnFunction · 0.85
FatalfMethod · 0.80
RunServerOnPortFunction · 0.70
WaitFunction · 0.70
SubscribeMethod · 0.65
PublishMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected