mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
feat(verifier): name extractors for diff surfacing
bindExtract accepts an optional name argument; falls back to extractor_N when omitted. The name is stored on extractorState alongside prev/curr value caches that the next change will use to emit per-step diffs.
This commit is contained in:
1 parent
cbef329cdd
commit
1b35e5a6a6
2 files changed
+39
-3
No files matched your search
@@ -894,6 +894,26 @@ func TestSelectorStringFromJS_CanonicalGrammar(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtract_DefaultsAndNamedNames verifies bindExtract assigns a fallback
|
||||
// `extractor_N` name when no name is supplied and respects an explicit one.
|
||||
func TestExtract_DefaultsAndNamedNames(t *testing.T) {
|
||||
verifier := newVerifier(t)
|
||||
mustLoad(t, verifier, `
|
||||
__sanderling__.extract(state => 1);
|
||||
__sanderling__.extract(state => 2, "ledgerRows");
|
||||
__sanderling__.extract(state => 3);
|
||||
`)
|
||||
if len(verifier.extractors) != 3 {
|
||||
t.Fatalf("extractors registered: got %d, want 3", len(verifier.extractors))
|
||||
}
|
||||
want := []string{"extractor_0", "ledgerRows", "extractor_2"}
|
||||
for i, name := range want {
|
||||
if got := verifier.extractors[i].name; got != name {
|
||||
t.Errorf("extractor %d name: got %q, want %q", i, got, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestSelectorStringFromJS_NullEmpty verifies that nil/undefined args produce
|
||||
// an empty string instead of "null"/"undefined" garbage.
|
||||
func TestSelectorStringFromJS_NullEmpty(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user