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

Function TestEncBuiltinJsonMarshalBool

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

Source from the content-addressed store, hash-verified

97}
98
99func TestEncBuiltinJsonMarshalBool(t *testing.T) {
100 s := RunServerOnPort(TEST_PORT)
101 defer s.Shutdown()
102
103 ec := NewJsonEncodedConn(t)
104 defer ec.Close()
105 ch := make(chan bool)
106
107 ec.Subscribe("json_bool", func(b bool) {
108 if !b {
109 t.Fatalf("Received test of '%v', wanted 'true'\n", b)
110 }
111 ch <- true
112 })
113 ec.Publish("json_bool", true)
114 if e := Wait(ch); e != nil {
115 t.Fatal("Did not receive the message")
116 }
117}
118
119func TestEncBuiltinJsonMarshalNull(t *testing.T) {
120 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