MCPcopy Create free account
hub / github.com/pquerna/ffjson / TestMarshalerEscaping

Function TestMarshalerEscaping

tests/encode_test.go:132–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func TestMarshalerEscaping(t *testing.T) {
133 var c C
134 want := `"\u003c\u0026\u003e"`
135 b, err := json.Marshal(c)
136 if err != nil {
137 t.Fatalf("Marshal(c): %v", err)
138 }
139 if got := string(b); got != want {
140 t.Errorf("Marshal(c) = %#q, want %#q", got, want)
141 }
142
143 var ct CText
144 want = `"\"\u003c\u0026\u003e\""`
145 b, err = json.Marshal(ct)
146 if err != nil {
147 t.Fatalf("Marshal(ct): %v", err)
148 }
149 if got := string(b); got != want {
150 t.Errorf("Marshal(ct) = %#q, want %#q", got, want)
151 }
152}
153
154func TestAnonymousNonstruct(t *testing.T) {
155 var i IntType = 11

Callers

nothing calls this directly

Calls 1

FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…