Files
sanspie 2744cff481
ci-platforms / build (amd64, darwin, macos-15-intel) (push) Skipped
ci-platforms / build (amd64, windows, windows-2022) (push) Skipped
ci-platforms / build (arm64, darwin, macos-15) (push) Skipped
ci / checks (push) Successful in 21m57s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 23m31s
Stage 9.6c1: project refs and refactorings without the editor (D298)
2026-10-20 12:12:18 +03:00

21 lines
535 B
Go

package refs
import (
"testing"
"aego/core/ids"
"aego/schema"
)
func TestRewriteNested(t *testing.T) {
a, b := ids.AssetID{Hi: 1, Lo: 1}, ids.AssetID{Hi: 2, Lo: 2}
v := schema.Value{Kind: schema.KindList, List: []schema.Value{schema.Asset(ids.AssetID{}), schema.Asset(a)}}
nv, ok := rewrite(v, swapAsset(a, b))
if !ok || nv.List[1].Asset != b || v.List[1].Asset != a {
t.Fatal("rewrite must replace inside lists without touching the original")
}
if leafAny(nv, isAsset(a)) {
t.Fatal("no old reference may remain")
}
}