This commit moves the TestSortValues function from dump_test.go to
common_test.go to mirror the new implementation location. It also
slightly formats the tests to be consistent with the rest of the package.
If ConfigState.SortKeys is true, then dump and format will sort map keys
before displaying them. Only native types (bool, ints, uint, uintptr,
string) are supported, other slices are left unchanged.
The motivation is to have more diffable output, mostly for test purpose.
This commit adds tests for the recent cgo handling of char, unsigned char,
and uint8_t arrays.
In addition, it adds an architecture for the cgo specific testing based on
build constraints. This was done because spew itself does not require
cgo, but in order to test its handling of the cgo types it needs to be fed
cgo data. Rather than force all users to have a system which supports cgo
and an external compiler just to run the tests, the cgo test support must
explicitly be turned on via a build tag.
This commit adds tests for a struct which has an embedded struct pointer
and a field that is a pointer to the same object. This ensures the cycle
detection is properly reset between fields.
Previously, the tests did not include maps with more than a single entry
since the iteration order is randomized and the tests only accepted a
single valid expected value. This commit modifies the tests to accept
multiple valid expected values and adds tests for a multi-entry map to
both Dump and Formatter.