From dc9d962690e1e88e41085ed018ecc487a9fc2d88 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 5 Oct 2026 23:07:02 +0200 Subject: [PATCH] Test that a fresh read inside a named pick reads none of the pick --- pick_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pick_test.go b/pick_test.go index a24d4b1..f8eed14 100644 --- a/pick_test.go +++ b/pick_test.go @@ -332,3 +332,15 @@ func TestAColumnReadingABoundColumnIsThatColumn(t *testing.T) { t.Errorf("the pick was null %d times in 100 records, want both outcomes", nulls) } } + +func TestAFreshReadInsideANamedPickReadsNoneOfThePick(t *testing.T) { + f := engine(5) + src := `{"format":"{w as p}{p.a}|{p.a.b}","w":{"format":"{a}","a":{"format":"{c}|{b}","b":["1","2","3"],"c":{"format":"{b}","b":["x","y","z"]}}}}` + want := regexp.MustCompile(`^[xyz]\|([123])\|([123])$`) + for i := 0; i < 100; i++ { + got := mustRender(t, f, src) + if m := want.FindStringSubmatch(got); m == nil || m[1] != m[2] { + t.Fatalf("draw %d = %q, want p.a's c drawn afresh and its b read from p's pick", i, got) + } + } +}