Hacker News new | past | comments | ask | show | jobs | submit login

I frequently use anonymous types in my unit tests in Go. I create a custom type describing the inputs, behaviors and expected outputs of a test case. I create a collection of these cases, and use Go's standard library testing package to run the test cases concurrently scaling to the CPU's available threads.

Here's a simple example: https://github.com/dharmab/skyeye/blob/main/pkg/bearings/bea...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: