Files
mesh-sdk/go/testbus/testbus_test.go
T
jschoubben f90189353c Fold H2's new tests into existing ones: go/ at 327 unit tests (from 331), TypeScript at 48 (from 49)
The eight Go test functions H2 added become subtests of existing tests
(catalogue's state test, the bundle's state test, the views test, the process
state test, the testbus bus test, the seal byte-for-byte test), and four more
are folded beside them (two seal, two process watch); the two TypeScript seal
tests become one, and two more TypeScript tests are folded into their
neighbours. No assertion is lost.

Builds: design 47 H2 §819
2026-11-22 02:25:44 +01:00

28 lines
472 B
Go

package testbus
import (
"fmt"
"testing"
)
// failed is a testing.TB that keeps what a helper failed with, so the helper's own failure is read, not suffered.
type failed struct {
testing.TB
words string
}
func (f *failed) Helper() {}
func (f *failed) Fatalf(format string, args ...any) {
f.words = fmt.Sprintf(format, args...)
panic(f)
}
func catch(f *failed, run func()) {
defer func() {
if r := recover(); r != nil && r != f {
panic(r)
}
}()
run()
}