frankban / quicktest

Quick helpers for testing Go applications
MIT License
529 stars 27 forks source link

make C.Run more general #40

Closed rogpeppe closed 5 years ago

rogpeppe commented 5 years ago

Currently, c.Run can only be used if c.TB implements exactly the Run method provided by *testing.T. However, there are other possible implementations of testing.TB - most notably *testing.B, which has its own Run method for invoking sub-benchmarks.

There could also be other potential implementations that don't involve the testing package at all.

Instead of special-casing the Run method signatures implemented by *testing.B and *testing.C, this PR allows Run to work on any testing.TB implementation that takes a compatible function.