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

Function TestEncBuiltinGobMarshalString

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

Source from the content-addressed store, hash-verified

31}
32
33func TestEncBuiltinGobMarshalString(t *testing.T) {
34 s := RunServerOnPort(TEST_PORT)
35 defer s.Shutdown()
36
37 ec := NewGobEncodedConn(t)
38 defer ec.Close()
39 ch := make(chan bool)
40
41 testString := "Hello World!"
42
43 ec.Subscribe("gob_string", func(s string) {
44 if s != testString {
45 t.Fatalf("Received test string of '%s', wanted '%s'\n", s, testString)
46 }
47 ch <- true
48 })
49 ec.Publish("gob_string", testString)
50 if e := Wait(ch); e != nil {
51 t.Fatal("Did not receive the message")
52 }
53}
54
55func TestEncBuiltinGobMarshalInt(t *testing.T) {
56 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