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

Function TestEncBuiltinJsonMarshalNull

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

Source from the content-addressed store, hash-verified

117}
118
119func TestEncBuiltinJsonMarshalNull(t *testing.T) {
120 s := RunServerOnPort(TEST_PORT)
121 defer s.Shutdown()
122
123 ec := NewJsonEncodedConn(t)
124 defer ec.Close()
125
126 type TestType struct{}
127 ch := make(chan bool)
128
129 var testValue *TestType
130
131 ec.Subscribe("json_null", func(i any) {
132 if i != nil {
133 t.Fatalf("Received test of '%v', wanted 'nil'\n", i)
134 }
135 ch <- true
136 })
137 ec.Publish("json_null", testValue)
138 if e := Wait(ch); e != nil {
139 t.Fatal("Did not receive the message")
140 }
141}
142
143func TestEncBuiltinJsonMarshalArray(t *testing.T) {
144 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