Reuse frozen inspection mapping lookups
This commit is contained in:
@@ -102,7 +102,11 @@ func TestDocumentLookupMatchesPathScan(t *testing.T) {
|
||||
{Key: "01", Value: &document.Node{Kind: document.String, Text: "leading zero key"}},
|
||||
{Key: "items", Value: sequence},
|
||||
}}
|
||||
lookup := buildDocumentLookup(root)
|
||||
applicationRoot := &document.Node{Kind: document.Mapping, Mapping: []document.Entry{
|
||||
{Key: "shared", Value: sequence},
|
||||
{Key: "application", Value: &document.Node{Kind: document.Mapping, Mapping: []document.Entry{{Key: "value", Value: &document.Node{Kind: document.String, Text: "application"}}}}},
|
||||
}}
|
||||
lookup := buildDocumentLookup(root, applicationRoot)
|
||||
paths := []Path{
|
||||
Path{},
|
||||
Keys("0"),
|
||||
@@ -123,6 +127,13 @@ func TestDocumentLookupMatchesPathScan(t *testing.T) {
|
||||
t.Errorf("indexed lookup %s = (%p, %v), want (%p, %v)", path.String(), gotNode, gotFound, wantNode, wantFound)
|
||||
}
|
||||
}
|
||||
for _, path := range []Path{Path{}, Keys("shared"), Keys("shared").Index(1).Key("name"), Keys("application", "value")} {
|
||||
wantNode, wantFound := documentAtPath(applicationRoot, path)
|
||||
gotNode, gotFound := documentAtPathWithLookup(applicationRoot, path, lookup)
|
||||
if gotNode != wantNode || gotFound != wantFound {
|
||||
t.Errorf("indexed application lookup %s = (%p, %v), want (%p, %v)", path.String(), gotNode, gotFound, wantNode, wantFound)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyResolutionMetadataPreservesOverlappingDeltaOrder(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user