Skip to content

Commit bbf72e7

Browse files
committed
update documentation
1 parent 809b9aa commit bbf72e7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

assert/doc.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Package assert includes runtime assertion helpers both for normal execution as
33
well as a assertion package for Go's testing. What makes solution unique is its
44
capable to support both modes with same API. Only thing you need to do is to
5-
add following two lines at the beginning of your unit tests:
5+
add a PushTester line at the beginning of your unit tests:
66
77
func TestInvite(t *testing.T) {
88
defer assert.PushTester(t)() // push testing variable t beginning of any test
@@ -14,14 +14,14 @@ add following two lines at the beginning of your unit tests:
1414
# Merge Runtime And Unit Test Assertions
1515
1616
Especially powerful feature is that even if some assertion violation happens
17-
during the execution of called functions not the test function itself. See the
18-
above example. If assertion failure happens inside of the Invite() function
19-
instead of the actual test function, TestInvite, it's still reported correctly
20-
as normal test failure when TestInvite unit test is executed. It doesn't matter
21-
how deep the recursion is, or if parallel test runs are performed. It works just
22-
as you hoped.
23-
24-
This is the actual Invite function implementation's first two lines. Even the
17+
during the execution of called functions, and not the test function itself, they
18+
are catched. See the above example. If assertion failure happens inside the
19+
Invite() function instead of the actual test function, TestInvite, it's still
20+
reported correctly as normal test failure. It doesn't matter how deep the
21+
recursion is, or if parallel test runs are performed. It works just as you
22+
hoped.
23+
24+
This is the actual Invite function implementation's first two lines. Even if the
2525
assertion line is written more for runtime detection and active comment, it
2626
catches all unit test errors as well:
2727

err2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ var (
7777
//
7878
// You can have unlimited amount of error handlers. They are called if error
7979
// happens and they are called in the same order as they are given or until one
80-
// of them resets the error like Reset (notice other predefined error handlers)
81-
// in the next samples:
80+
// of them resets the error like Reset (notice the other predefined error
81+
// handlers) in the next samples:
8282
//
8383
// defer err2.Handle(&err, err2.Reset, err2.Log) // Log not called
8484
// defer err2.Handle(&err, err2.Noop, err2.Log) // handlers > 1: err annotated

0 commit comments

Comments
 (0)