Implement JSON snapshot testing for JoinIR regression detection. Implementation: - tests/fixtures/joinir/v0_*.jsonir: 6 snapshot fixtures for minimal JoinIR cases - src/tests/joinir_json_min.rs: Added 6 snapshot comparison tests Fixtures: - v0_skip_ws_min.jsonir (1338 bytes) - v0_funcscanner_trim_min.jsonir (4484 bytes) - v0_funcscanner_append_defs_min.jsonir (988 bytes) - v0_stage1_usingresolver_min.jsonir (987 bytes) - v0_stageb_body_min.jsonir (1074 bytes) - v0_stageb_funcscanner_min.jsonir (962 bytes) Usage: # Run snapshot tests NYASH_JOINIR_SNAPSHOT_TEST=1 cargo test --release joinir_json_v0_ # Regenerate fixtures (after intentional changes) NYASH_JOINIR_SNAPSHOT_TEST=1 NYASH_JOINIR_SNAPSHOT_GENERATE=1 cargo test --release joinir_json_v0_ Purpose: - Fix current JoinIR shape as v0 baseline (pre-generic state) - Detect unintended regressions during genericization - Allow intentional fixture updates when design changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 line
4.4 KiB
Plaintext
1 line
4.4 KiB
Plaintext
{"version":0,"entry":0,"functions":[{"id":0,"name":"trim_main","params":[5000],"exit_cont":null,"body":[{"type":"compute","op":{"kind":"const","dst":5005,"value_type":"string","value":""}},{"type":"compute","op":{"kind":"binop","dst":5001,"op":"add","lhs":5005,"rhs":5000}},{"type":"compute","op":{"kind":"boxcall","dst":5002,"box":"StringBox","method":"length","args":[5001]}},{"type":"compute","op":{"kind":"const","dst":5006,"value_type":"integer","value":0}},{"type":"call","func":2,"args":[5001,5006,5002],"k_next":null,"dst":5003},{"type":"compute","op":{"kind":"binop","dst":5004,"op":"add","lhs":5002,"rhs":5006}},{"type":"call","func":1,"args":[5001,5003,5004],"k_next":null,"dst":null}]},{"id":1,"name":"loop_step","params":[6000,6001,6002],"exit_cont":null,"body":[{"type":"compute","op":{"kind":"compare","dst":6003,"op":"gt","lhs":6002,"rhs":6001}},{"type":"compute","op":{"kind":"const","dst":6019,"value_type":"bool","value":false}},{"type":"compute","op":{"kind":"boxcall","dst":6004,"box":"StringBox","method":"substring","args":[6000,6001,6002]}},{"type":"compute","op":{"kind":"compare","dst":6020,"op":"eq","lhs":6003,"rhs":6019}},{"type":"jump","cont":0,"args":[6004],"cond":6020},{"type":"compute","op":{"kind":"const","dst":6005,"value_type":"integer","value":1}},{"type":"compute","op":{"kind":"binop","dst":6006,"op":"sub","lhs":6002,"rhs":6005}},{"type":"compute","op":{"kind":"boxcall","dst":6007,"box":"StringBox","method":"substring","args":[6000,6006,6002]}},{"type":"compute","op":{"kind":"const","dst":6012,"value_type":"string","value":" "}},{"type":"compute","op":{"kind":"compare","dst":6008,"op":"eq","lhs":6007,"rhs":6012}},{"type":"compute","op":{"kind":"const","dst":6013,"value_type":"string","value":"\\t"}},{"type":"compute","op":{"kind":"compare","dst":6009,"op":"eq","lhs":6007,"rhs":6013}},{"type":"compute","op":{"kind":"const","dst":6014,"value_type":"string","value":"\\n"}},{"type":"compute","op":{"kind":"compare","dst":6010,"op":"eq","lhs":6007,"rhs":6014}},{"type":"compute","op":{"kind":"const","dst":6015,"value_type":"string","value":"\\r"}},{"type":"compute","op":{"kind":"compare","dst":6011,"op":"eq","lhs":6007,"rhs":6015}},{"type":"compute","op":{"kind":"binop","dst":6016,"op":"or","lhs":6008,"rhs":6009}},{"type":"compute","op":{"kind":"binop","dst":6017,"op":"or","lhs":6016,"rhs":6010}},{"type":"compute","op":{"kind":"binop","dst":6018,"op":"or","lhs":6017,"rhs":6011}},{"type":"compute","op":{"kind":"compare","dst":6021,"op":"eq","lhs":6018,"rhs":6019}},{"type":"jump","cont":1,"args":[6004],"cond":6021},{"type":"compute","op":{"kind":"binop","dst":6022,"op":"sub","lhs":6002,"rhs":6005}},{"type":"call","func":1,"args":[6000,6001,6022],"k_next":null,"dst":null}]},{"id":2,"name":"skip_leading","params":[7000,7001,7002],"exit_cont":null,"body":[{"type":"compute","op":{"kind":"compare","dst":7003,"op":"ge","lhs":7001,"rhs":7002}},{"type":"jump","cont":2,"args":[7001],"cond":7003},{"type":"compute","op":{"kind":"const","dst":7004,"value_type":"integer","value":1}},{"type":"compute","op":{"kind":"binop","dst":7005,"op":"add","lhs":7001,"rhs":7004}},{"type":"compute","op":{"kind":"boxcall","dst":7006,"box":"StringBox","method":"substring","args":[7000,7001,7005]}},{"type":"compute","op":{"kind":"const","dst":7011,"value_type":"string","value":" "}},{"type":"compute","op":{"kind":"compare","dst":7007,"op":"eq","lhs":7006,"rhs":7011}},{"type":"compute","op":{"kind":"const","dst":7012,"value_type":"string","value":"\\t"}},{"type":"compute","op":{"kind":"compare","dst":7008,"op":"eq","lhs":7006,"rhs":7012}},{"type":"compute","op":{"kind":"const","dst":7013,"value_type":"string","value":"\\n"}},{"type":"compute","op":{"kind":"compare","dst":7009,"op":"eq","lhs":7006,"rhs":7013}},{"type":"compute","op":{"kind":"const","dst":7014,"value_type":"string","value":"\\r"}},{"type":"compute","op":{"kind":"compare","dst":7010,"op":"eq","lhs":7006,"rhs":7014}},{"type":"compute","op":{"kind":"binop","dst":7015,"op":"or","lhs":7007,"rhs":7008}},{"type":"compute","op":{"kind":"binop","dst":7016,"op":"or","lhs":7015,"rhs":7009}},{"type":"compute","op":{"kind":"binop","dst":7017,"op":"or","lhs":7016,"rhs":7010}},{"type":"compute","op":{"kind":"const","dst":7018,"value_type":"bool","value":false}},{"type":"compute","op":{"kind":"compare","dst":7019,"op":"eq","lhs":7017,"rhs":7018}},{"type":"jump","cont":3,"args":[7001],"cond":7019},{"type":"call","func":2,"args":[7000,7005,7002],"k_next":null,"dst":null}]}]} |