Skip to content

Commit ba69b38

Browse files
committed
go documentation update
1 parent 27f7922 commit ba69b38

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

assert/assert.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,28 @@ const (
2828
// name, line number, and caller function.
2929
Development
3030

31-
// Test minimalistic asserter for unit test use. Much more pragmatic is the
32-
// TestFull assert that is the default if test asserter isn't given and
33-
// still PushTester is called.
34-
// Deprecated: Use TestFull instead.
31+
// Test minimalistic asserter for unit test use. More pragmatic is the
32+
// TestFull asserter (default).
33+
//
34+
// Use this asserter if your IDE/editor doesn't support long file names, or
35+
// for temporary problem solving for your programming environment.
3536
Test
3637

37-
// TestFull assert that is the default if no test asserter is given and
38-
// still PushTester is called. The TestFull asserter includes caller info
39-
// and call stack to tests similarly like err2's error traces. You need a
40-
// proper test result parser like 'github.com/lainio/nvim-go' (fork). Also
41-
// most of the make-go-parsers can process the output properly and allow
42-
// traverse of locations of the error trace.
43-
44-
// The call stack produced by these err2/assert test asserts can be used
45-
// over package boundaries. For example, if your app and it's sub packages
46-
// use err2/asserts for both tests and runtime asserts the results will be
47-
// automatically merged. If any of the runtime asserts fails in app tests
48-
// from the sub packages the current test fails too.
38+
// TestFull asserter (default). The TestFull asserter includes caller info
39+
// and call stack for unit testing, similarly like err2's error traces.
40+
//
41+
// The call stack produced by the test asserts can be used over Go module
42+
// boundaries. For example, if your app and it's sub packages both use
43+
// err2/assert for unit testing and runtime checks, the runtime assertions
44+
// will be automatically converted to test asserts on the fly. If any of
45+
// the runtime asserts in sub packages fails during the app tests, the
46+
// current app test fails too.
47+
//
48+
// Note, that the cross-module assertions produce long file names (path
49+
// included), and some of the Go test result parsers cannot handle that.
50+
// A proper test result parser like 'github.com/lainio/nvim-go' (fork)
51+
// works very well. Also most of the make result parsers can process the
52+
// output properly and allow traverse of locations of the error trace.
4953
TestFull
5054

5155
// Debug asserter transforms assertion violations to panics which is the
@@ -131,6 +135,11 @@ const (
131135
//
132136
// Because PushTester returns PopTester it allows us to merge these two calls to
133137
// one line. See the first t.Run call. NOTE. More information in PopTester.
138+
//
139+
// PushTester allows you to change the current default asserter by accepting it
140+
// as a second argument. NOTE. That it change the default asserter for whole
141+
// package. The argument is mainly for temporary development use and isn't not
142+
// preferrred API usage.
134143
func PushTester(t testing.TB, a ...defInd) function {
135144
if len(a) > 0 {
136145
SetDefault(a[0])

0 commit comments

Comments
 (0)