MCPcopy
hub / github.com/gorilla/websocket / TestDeprecatedJSON

Function TestDeprecatedJSON

json_test.go:93–116  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestDeprecatedJSON(t *testing.T) {
94 var buf bytes.Buffer
95 wc := newTestConn(nil, &buf, true)
96 rc := newTestConn(&buf, nil, false)
97
98 var actual, expect struct {
99 A int
100 B string
101 }
102 expect.A = 1
103 expect.B = "hello"
104
105 if err := WriteJSON(wc, &expect); err != nil {
106 t.Fatal("write", err)
107 }
108
109 if err := ReadJSON(rc, &actual); err != nil {
110 t.Fatal("read", err)
111 }
112
113 if !reflect.DeepEqual(&actual, &expect) {
114 t.Fatal("equal", actual, expect)
115 }
116}

Callers

nothing calls this directly

Calls 3

newTestConnFunction · 0.85
WriteJSONFunction · 0.85
ReadJSONFunction · 0.85

Tested by

no test coverage detected