Skip to content

fix(phel): restore :phel branch for p/thrown? assert-expr#897

Merged
jeaye merged 1 commit into
jank-lang:mainfrom
phel-lang:fix/phel-thrown
May 27, 2026
Merged

fix(phel): restore :phel branch for p/thrown? assert-expr#897
jeaye merged 1 commit into
jank-lang:mainfrom
phel-lang:fix/phel-thrown

Conversation

@Chemaclass

@Chemaclass Chemaclass commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

#888 assumed Phel could share the Clojure JVM p/thrown? body. It can't, for two reasons:

  1. Arg order. Phel's phel.test/assert-expr is [form message], not [msg form]. The :default body binds args wrong and is fails to resolve p/thrown? at compile time — every test file using it gets skipped. Fixed on phel-lang main (phel-lang/phel-lang#2149) but not yet in a stable release.

  2. Event type. phel.test/report knows :pass/:failed/:error, not Clojure's :fail. :fail events fall through :default without touching counters — failed p/thrown? assertions are silently swallowed.

Re-add a :phel branch: correct arg order, catches \Throwable, reports :type :failed/:pass.

Test plan

  • vendor/bin/phel test test/clojure/string_test/escape.cljcPassed: 6, Failed: 4, Total: 10 (previously skipped at compile time).

The simplification in jank-lang#888 dropped Phel's reader-conditional branch on
the assumption Phel could share the Clojure JVM body. That assumption
breaks Phel for two reasons:

  1. Argument order. Phel's `phel.test/assert-expr` multimethod is
     defined as `[form message]` (not Clojure JVM's `[msg form]`), so
     the shared `:default` body binds the args in the wrong order and
     the expansion fails to resolve `p/thrown?` at compile time —
     skipping every test file that uses it. phel-lang main has
     aligned the signature (phel-lang#2149), but no stable release
     ships that fix yet.

  2. Event-type mismatch. `phel.test/report` dispatches on `:type` and
     recognises `:pass`/`:failed`/`:error`, not Clojure's `:fail`. The
     shared body emits `:fail`, which falls through phel's `:default`
     report method — fanning the event out without touching the
     counters. Failed `p/thrown?` assertions are silently swallowed
     and the suite reports a passing run.

Re-introduce a `:phel` branch that registers `'p/thrown?` with the
correct argument order, catches PHP's `\Throwable`, and reports via
`t/report` using `:type :failed`/`:type :pass` so phel's reporter set
updates correctly.
@jeaye jeaye merged commit 406d5c1 into jank-lang:main May 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants