MCPcopy Create free account
hub / github.com/github/gh-aw / TestImprovementComparison

Function TestImprovementComparison

pkg/parser/integration_test.go:146–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

144}
145
146func TestImprovementComparison(t *testing.T) {
147 yamlContent := `name: Test
148engine: claude
149invalid_prop: bad_value
150another_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}

Callers

nothing calls this directly

Calls 3

LocateJSONPathInYAMLFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected