10 ms·
> A more batteries-included library could include some assertion methods to test for value equality/inequality and provide some pre-canned error messages. For
by mdwrigh2 14y ago
> A more batteries-included library could include some assertion methods to test for value equality/inequality and provide some pre-canned error messages.
For value equality, just use reflect.DeepEqual[1]. The wiki also has a page on table driven tests, which is worth a read[2].
[1]: http://golang.org/pkg/reflect/#DeepEqual http://golang.org/pkg/reflect/#DeepEqual
[2]: http://code.google.com/p/go-wiki/wiki/TableDrivenTests http://code.google.com/p/go-wiki/wiki/TableDrivenTests
- kisielk 14y agoJust the other day I stumbled upon that wiki page, it looks like a pretty reasonable technique and I've started adopting it. Thanks for the pointer to the reflect package, I shall check it out.