Documentation
¶
Overview ¶
Package roundtrip states meyer's round-trip property in one place.
PLAN.md uses it in place of the parse-tree goldens SQLite cannot produce: rendering a tree back to SQL and re-parsing it must yield the same tree. Accept/reject conformance cannot see a dropped clause or an operator associated the wrong way; this can.
It lives in its own package because three callers need it — the corpus test, the fuzz target and cmd/difftest — and when each had its own copy they drifted: two of the three had quietly stopped checking that rendering is idempotent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Ok bool
Rendered string // the SQL the tree was rendered back to
Reason string // why it failed: one short phrase
Want string // the structural dump of the original tree
Got string // the structural dump of the re-parsed one
}
Result describes one round trip. Ok is false when the property failed, and the other fields say how.
func Check ¶
Check renders stmts back to SQL, re-parses it, and compares the two trees.
Equality is structural: byte spans and the Raw fields differ after a round trip by construction, and the renderer promises nothing about them, so dump.Structure leaves both out.
func CheckSQL ¶
CheckSQL parses src and, if it parses, checks the property. An input the parser rejects is not a round-trip failure, and reports Ok.