MCPcopy Create free account
hub / github.com/goadesign/goa / TestFormatAwareComparisons

Function TestFormatAwareComparisons

codegen/testutil/example_test.go:25–37  ·  view source on GitHub ↗

Example: Format-aware comparisons

(t *testing.T)

Source from the content-addressed store, hash-verified

23
24// Example: Format-aware comparisons
25func TestFormatAwareComparisons(t *testing.T) {
26 // Test Go code - automatically formatted (auto-detected by .go.golden)
27 goCode := `package main
28import "fmt"
29func main(){fmt.Println("unformatted")}`
30
31 testutil.AssertGo(t, "testdata/golden/formatted.go.golden", goCode)
32
33 // Test JSON - automatically pretty-printed (auto-detected by .json.golden)
34 jsonData := []byte(`{"name":"test","value":42,"items":["a","b","c"]}`)
35
36 testutil.AssertJSON(t, "testdata/golden/config.json.golden", jsonData)
37}
38
39// Example: Testing with subtests
40func TestWithSubtests(t *testing.T) {

Callers

nothing calls this directly

Calls 2

AssertGoFunction · 0.92
AssertJSONFunction · 0.92

Tested by

no test coverage detected