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

Function TestEncBuiltinJsonMarshalEmptyString

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

NewJsonEncodedConnFunction · 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