Extend direct test runner with array, while, and cross-module support#160
Open
tompassarelli wants to merge 2 commits into
Open
Extend direct test runner with array, while, and cross-module support#160tompassarelli wants to merge 2 commits into
tompassarelli wants to merge 2 commits into
Conversation
The direct-frontend test runner now handles a broader set of Zero language features, enabling integration tests that were previously marked xfail to run and pass. New capabilities: - Array literals (EXPR_ARRAY_LITERAL) and indexing (EXPR_INDEX) - While loops with break/continue and iteration guard - Assignment to variables, array elements, and shape fields - Borrow expressions (&x) and casts (passthrough in interpreted context) - Choice/enum variant resolution (e.g. FailureReason.dependency_cycle) - Mutable reference (mutref) parameter writeback to caller environment - Array and shape equality comparison
|
@tompassarelli is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
STMT_CONTINUE inside a nested block (e.g., if inside while) did not propagate upward, so remaining statements in the loop body would still execute. Add a separate `continued` flag that propagates through nested blocks the same way `broke` does, and is consumed by the while loop handler to restart the next iteration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The direct-frontend test runner (
zero test) currently supports basic expressions and simple unit tests but cannot evaluate integration tests that use arrays, while loops, or cross-module function calls. This means projects with richer test suites have most of their tests markedxfail.This PR extends the test runner to handle:
EXPR_ARRAY_LITERAL,EXPR_INDEX, bounds checking,TEST_VALUE_ARRAYwith deep copy/free/equalitybreak/continuesupport and a 100k-iteration guardarr[i] = val), and shape fields (shape.field = val)EXPR_BORROWandEXPR_CASTevaluate to their inner expression (borrows are no-ops in the interpreter)FailureReason.dependency_cycleresolves to the variant's tag indexmutref<T>parameters propagate modifications back to the caller's environment after the function returnsImpact
Tested against a workflow scheduler codebase with 49 tests (9 unit + 40 xfail integration): 19 of 40 previously-xfail tests now pass. The remaining 18 fail at assertion time (the test logic runs but produces incorrect results in complex multi-function scheduling scenarios — likely edge cases in cross-module state threading). No regressions on existing conformance tests.
Context
I've been building a typed workflow language called Beagle and was running cross-language benchmarks (Beagle vs Zero vs Python+mypy) to compare how type systems affect AI agent repair accuracy. The Zero track was blocked because
zero testcouldn't evaluate the integration test oracle — this PR unblocks that.Test plan
makecompiles cleanly with-Wall -Wextra -Wpedanticconformance/native/pass/tests still pass