Repository navigation
v0.6.1
Hegel can now be used as a library by other JVM frontends (#12).
- New
Hegel.run(body, settings, reporter)returns aRunReportinstead of throwing: the verdict
(RunStatus), per-outcome case counts (RunStatistics), the engine's message for an errored
run, and oneFailureper distinct counterexample carrying the body's exception, the labelled
top-level draws of the minimal example as Java values, the notes, the engine's origin string, and
the reproduce blob.RunReport.throwIfFailed()reproducesHegel.test's throwing behaviour. - New
Reporterinterface receives everything a run prints as callbacks (engine output, case
start/finish, final-replay draws and notes, each failure, the final report). Hegel no longer
writes toSystem.errdirectly:Hegel.testusesReporter.printing(System.err), which prints
exactly what it printed before, andReporter.silent()turns output off. BothHegel.testand
Hegel.runaccept a reporter as an optional third argument. Hegel.testnow returns theRunReportof a passed run. This is source-compatible (callers that
ignored thevoidresult compile unchanged) but code compiled against an earlier release must be
recompiled.- New
TestCase.isFinal()tells a test body whether it is running the final replay of a
counterexample, where its own diagnostics will be seen. - New
TestCase.span(label, body)and publicLabelconstants (plusLabel.of(name)for minting
stable custom labels) let custom composite generators enclose their draws in a labelled span, so
the engine shrinks the structure as a unit.TestCase.startSpan/stopSpanare now documented. - New
Settings.infrastructurePackages(prefixes...)lists a frontend's own class-name prefixes so
they are skipped, like Hegel's and JUnit's, when locating the user frame a failure was thrown from. - Reported draw names now follow the other Hegel frontends: a label drawn more than once in a case
is numbered from its second use (x,x_2,x_3) so no value is lost, and unlabelled draws are
numbered among themselves (draw_1,draw_2, ... — previously a labelled draw also advanced the
counter). A note made inside a composite generator is now reported after the enclosing draw's
value rather than before it. Settings.verbositynow governs the frontend's own output as documented:QUIETprints no
draws or notes, andVERBOSE/DEBUGreport every case's draws and notes, not only the final
replay's.- A checked exception thrown from a test body (possible from Kotlin, Clojure, and other frontends)
is now rethrown as-is instead of failing with aClassCastException.
New artifact dev.hegel:hegel-lowlevel (Java 17+), for people binding Hegel or building a frontend
from scratch. It holds only the binding contract: the Libhegel interface (one method per
hegel_* function, raw handles and return codes), the Abi constants, LibraryLoader,
LibhegelException, and the LibhegelBackend service provider interface. Libhegel.load() finds
whichever binding is on the classpath. Both dev.hegel:hegel and dev.hegel:hegel-jna now depend
on it and register their bindings as service providers; nothing changes for their users. The
package is marked experimental: implementors should expect new methods as the engine grows.
HegelException now extends LibhegelException.