MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestCodeReviewResult_JSON

Function TestCodeReviewResult_JSON

internal/model/model_test.go:181–202  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

179}
180
181func TestCodeReviewResult_JSON(t *testing.T) {
182 r := CodeReviewResult{
183 RelevantFile: "api.go",
184 SuggestionContent: "suggestion",
185 ExistingCode: "old",
186 SuggestionCode: "new",
187 }
188
189 data, err := json.Marshal(r)
190 if err != nil {
191 t.Fatalf("marshal: %v", err)
192 }
193
194 var got CodeReviewResult
195 if err := json.Unmarshal(data, &got); err != nil {
196 t.Fatalf("unmarshal: %v", err)
197 }
198
199 if got != r {
200 t.Errorf("roundtrip mismatch:\n got %+v\n want %+v", got, r)
201 }
202}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected