(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestRefValMarshal(t *testing.T) { |
| 103 | var s = struct { |
| 104 | R0 Ref |
| 105 | R1 *Ref |
| 106 | R2 RefText |
| 107 | R3 *RefText |
| 108 | V0 Val |
| 109 | V1 *Val |
| 110 | V2 ValText |
| 111 | V3 *ValText |
| 112 | }{ |
| 113 | R0: 12, |
| 114 | R1: new(Ref), |
| 115 | R2: 14, |
| 116 | R3: new(RefText), |
| 117 | V0: 13, |
| 118 | V1: new(Val), |
| 119 | V2: 15, |
| 120 | V3: new(ValText), |
| 121 | } |
| 122 | const want = `{"R0":"ref","R1":"ref","R2":"\"ref\"","R3":"\"ref\"","V0":"val","V1":"val","V2":"\"val\"","V3":"\"val\""}` |
| 123 | b, err := json.Marshal(&s) |
| 124 | if err != nil { |
| 125 | t.Fatalf("Marshal: %v", err) |
| 126 | } |
| 127 | if got := string(b); got != want { |
| 128 | t.Errorf("got %q, want %q", got, want) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | func TestMarshalerEscaping(t *testing.T) { |
| 133 | var c C |
nothing calls this directly
no test coverage detected
searching dependent graphs…