Commit d450258
committed
feat(054-fix-16-test-regressions-caused-by-item-051-bytecod): Fix 16 test regressions caused by item 051 bytecode format change. wf_exec:new/1 now expects {Bytecode, MetadataMap} tuple but many callers still pass plain [opcode()] lists. The fix: make wf_exec:new/1 accept both formats — if passed a plain list, wrap it as {List, #{}} with empty metadata. This ensures backward compatibility. All 16 failures are function_clause errors in wf_exec:new/1 called from wf_case_runner and other test modules. After fixing, rebar3 eunit must show 0 failures. Also implement real loop condition evaluation: currently the loop_check opcode handler always continues without evaluating the loop policy. For {count, N} loops, track iteration count per loop scope and exit when count is reached. ACCEPTANCE TEST: Add to test/wf_acceptance_tests.erl a loop_count_test that compiles wf_term:loop({count, 3}, wf_term:task(counter, #{function => fun(Ctx) -> N = maps:get(n, Ctx, 0), {ok, Ctx#{n => N + 1}} end})). Execute it. Assert the result is {done, _} not {yield, _}. Assert final context has n => 3.
6 files changed
Lines changed: 1169 additions & 3 deletions
File tree
- .wreckit/items
- 051-implement-real-task-function-dispatch-in-wfexec-cu
- 054-fix-16-test-regressions-caused-by-item-051-bytecod
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments