(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func TestStructuredOutputSuccessFixtureAudit(t *testing.T) { |
| 40 | contractCommands := jsonContractCommandPathsWithVersion() |
| 41 | contractSet := make(map[string]bool, len(contractCommands)) |
| 42 | for _, command := range contractCommands { |
| 43 | contractSet[command] = true |
| 44 | } |
| 45 | |
| 46 | fixtures := jsonSuccessFixtureCoverage() |
| 47 | for _, command := range contractCommands { |
| 48 | if fixtures[command].file == "" { |
| 49 | t.Errorf("JSON contract command %q has no success JSON fixture coverage entry", command) |
| 50 | } |
| 51 | } |
| 52 | for command, fixture := range fixtures { |
| 53 | if fixture.file == "" { |
| 54 | t.Errorf("fixture coverage for %q has empty file", command) |
| 55 | } |
| 56 | if !contractSet[command] { |
| 57 | t.Errorf("fixture coverage includes non-contract command %q", command) |
| 58 | } |
| 59 | if len(fixture.tests) == 0 { |
| 60 | t.Errorf("fixture coverage for %q has no test functions", command) |
| 61 | } |
| 62 | source, err := os.ReadFile(fixture.file) |
| 63 | if err != nil { |
| 64 | t.Errorf("read fixture file for %q: %v", command, err) |
| 65 | continue |
| 66 | } |
| 67 | for _, testName := range fixture.tests { |
| 68 | if !strings.Contains(string(source), "func "+testName+"(") { |
| 69 | t.Errorf("fixture coverage for %q references missing %s in %s", command, testName, fixture.file) |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | func TestStructuredOutputGoldenSchemaAudit(t *testing.T) { |
| 76 | contract := loadJSONGoldenContract(t) |
nothing calls this directly
no test coverage detected