(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestImprovementComparison(t *testing.T) { |
| 147 | yamlContent := `name: Test |
| 148 | engine: claude |
| 149 | invalid_prop: bad_value |
| 150 | another_invalid: also_bad` |
| 151 | |
| 152 | // Simulate the error message we get from jsonschema |
| 153 | errorMessage := "at '': additional properties 'invalid_prop', 'another_invalid' not allowed" |
| 154 | |
| 155 | // Test old behavior |
| 156 | oldLocation := LocateJSONPathInYAML(yamlContent, "") |
| 157 | |
| 158 | // Test new behavior |
| 159 | newLocation := LocateJSONPathForPathInfo(yamlContent, JSONPathInfo{Path: "", Message: errorMessage}) |
| 160 | |
| 161 | // The old behavior should point to line 1, column 1 |
| 162 | if oldLocation.Line != 1 || oldLocation.Column != 1 { |
| 163 | t.Errorf("Old behavior expected Line=1, Column=1, got Line=%d, Column=%d", oldLocation.Line, oldLocation.Column) |
| 164 | } |
| 165 | |
| 166 | // The new behavior should point to line 3, column 1 (where invalid_prop is) |
| 167 | if newLocation.Line != 3 || newLocation.Column != 1 { |
| 168 | t.Errorf("New behavior expected Line=3, Column=1, got Line=%d, Column=%d", newLocation.Line, newLocation.Column) |
| 169 | } |
| 170 | |
| 171 | t.Logf("Improvement demonstrated: Old=(Line:%d, Column:%d) -> New=(Line:%d, Column:%d)", |
| 172 | oldLocation.Line, oldLocation.Column, newLocation.Line, newLocation.Column) |
| 173 | } |
nothing calls this directly
no test coverage detected