Precompute canonical paths before sorting
This commit is contained in:
@@ -357,6 +357,21 @@ func TestCompareDocumentTreesTracksSemanticChanges(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompareConfigurationValuesSortEscapedPointers(t *testing.T) {
|
||||
before := parseCompositionDocument(t, "before", `values: {z: old, 'a/b': old, 'a~b': old, nested: {x: old}}`)
|
||||
after := parseCompositionDocument(t, "after", `values: {z: new, 'a/b': new, 'a~b': new, nested: {x: new}}`)
|
||||
deltas := compareConfigurationValues(before, after)
|
||||
want := []string{"/values/a~0b", "/values/a~1b", "/values/nested/x", "/values/z"}
|
||||
if len(deltas) != len(want) {
|
||||
t.Fatalf("deltas = %#v", deltas)
|
||||
}
|
||||
for i, delta := range deltas {
|
||||
if got := delta.path.String(); got != want[i] {
|
||||
t.Fatalf("delta[%d] path = %q, want %q", i, got, want[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mustSchemaFor[T any](t *testing.T) *schemaDescriptor {
|
||||
t.Helper()
|
||||
schema, issue := testBuildSchema(reflect.TypeFor[T]())
|
||||
|
||||
Reference in New Issue
Block a user