Complete input destination implementation audit

This commit is contained in:
2026-10-14 14:06:38 +00:00
parent 2d8df22dd1
commit 945e111c4e
9 changed files with 107 additions and 20 deletions

View File

@@ -131,6 +131,25 @@ func TestLayeredDestinationMatchesExplicitlyWrappedInput(t *testing.T) {
}
}
func TestEmptyMountedMappingRetainsLowerChildren(t *testing.T) {
t.Parallel()
destination := Keys("collections", "weather")
loaded, err := LoadLayered(
Input{Source: Bytes("empty-main", []byte("{}\n")), Destination: destination},
testSecretBinding(),
LayeredOptions[map[string]any]{Underlays: []Underlay{{Inputs: []Input{{
Source: Bytes("lower", []byte("prompt: {title: retained}\n")), Destination: destination,
}}}}},
)
if err != nil {
t.Fatalf("LoadLayered: %v", err)
}
if got := layeredMapValue(t, testLoaded(loaded).Config, "collections", "weather", "prompt", "title"); got != "retained" {
t.Fatalf("lower child beneath empty mounted mapping = %#v, want retained", got)
}
}
func TestLayeredDestinationOverlayRetainsOrdinaryValueSemantics(t *testing.T) {
t.Parallel()