Open urso opened 4 years ago
@urso I've jumped in to this.
Is https://github.com/davecgh/go-spew approved for elastic projects? It makes for much more readable test errors.
go-spew is fine.
Note: testify package is basically everywhere. Not just in go-ucfg, but it is also used by many other projects. For sake of consistency we should switch to require.X
instead of trying to get rid or replace testify
.
The tests in go-ucfg use the
.../testify/assert
package for validation, but sometimes also for checking on intermediate errors. Theassert
package only logs an error to*testing.T
, but continues the test run. If there is a dependency on an operation to succeed (e.g. callingNewFrom
), then the test should fail immediately pointing out the failing line in code. This can be achieved by usingt.Fatal(f)
, use.../testify/require
instead ofassert
, or use constructors that can panic likeMustNewFrom
instead ofNewFrom
.By not failing and returning the test early, there might be a chance that validation/operations will panic. In this case the errors/logs stored in
*testing.T
will not be written to console, and the actual failure can't be inspected.