Add HL bytecode output test suite (tests/hlcode)#12758
Add HL bytecode output test suite (tests/hlcode)#12758Copilot wants to merge 7 commits intodevelopmentfrom
Conversation
Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
…w comments Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
|
@yuxiaomao Please check if this gives you a good workflow! Feel free to add some cases already, e.g. more of the stuff from #12682. |
|
@copilot The only problem I'm seeing right now is that if a test fails it just dumps the expected/actual output at me which makes it hard to spot the actual difference. We have a small diff implementation in tests/misc/src/diff which we can use. Let's take this opportunity to move it to |
Co-authored-by: Simn <634365+Simn@users.noreply.github.com>
Done in 6f92728. The diff implementation has been moved from |
Adds a test suite for validating HL code generation output, analogous to the JS optimization tests. Tests use a
@:hl(<> ... </>)annotation containing output copied verbatim fromdump/hlcode.txt.Structure
The macro auto-discovers all files in
src/cases/(allpackage cases;), readsdump/hlcode.txtafter generation, looks up each annotated function by its fully-qualified name (e.g.cases.HlCodeTests.registerAffixDesc), and compares normalized output.Normalization
Both expected and actual are normalized before comparison, making tests robust to unrelated changes:
;) — skipped entirelyfun@23(17h)→fun@N(Nh).12 @0→@0global/setglobal→ sequential$0,$1, … (per-function, order of first appearance)Failure output
When a test fails, a unified diff is shown to make it easy to spot the difference:
Example test
To add a test: compile with
-D dump, copy the relevant block fromdump/hlcode.txtinto an@:hl(<> ... </>)annotation.CI
Hooked into the HL target run (
tests/runci/targets/Hl.hx) alongside the existing misc HL tests. Requires only the Haxe compiler — no HL runtime needed.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.