@@ -25,7 +25,7 @@ all assert violations in the unit tests as well:
25
25
assert.That(c.isLeaf(invitersKey), "only leaf can invite")
26
26
27
27
If some assertion violation occurs in the deep call stack, they are still
28
- reported as a test failure . See the above code blocks. If assertion failure
28
+ reported as test failures . See the above code blocks. If assertion failure
29
29
happens somewhere inside the Invite function's call stack, it's still reported
30
30
correctly as a test failure of the TestInvite unit test. It doesn't matter how
31
31
deep the recursion is or if parallel test runs are performed. The failure report
@@ -35,12 +35,14 @@ chapter.
35
35
# Call Stack Traversal During Tests
36
36
37
37
The Assert package allows us to track assertion violations over the package and
38
- even module boundaries. When an assertion fails during the unit testing, the
39
- whole call stack is brought to unit test logs. And some help with your IDE, such
40
- as transferring output to a location list, for example, in Neovim/Vim. For
41
- example, you can find a proper test result parser like [nvim-go] (fork)
38
+ module boundaries. When an assertion fails during the unit testing, the whole
39
+ call stack is brought to unit test logs. And some help with your IDE, such as
40
+ transferring output to a location list in Neovim/Vim. For example, you can find
41
+ a compatible test result parser for Neovim from this plugin [nvim-go] (fork).
42
42
43
- With a sizeable multi-repo environment, this has proven to be valuable.
43
+ The call stack traversal has proven to be very valuable for package and module
44
+ development in Go, especially when following TDD and fast development feedback
45
+ cycles.
44
46
45
47
# Why Runtime Asserts Are So Important?
46
48
@@ -52,12 +54,12 @@ raise up quality of our software.
52
54
The assert package offers a convenient way to set preconditions to code which
53
55
allow us detect programming errors and API violations faster. Still allowing
54
56
production-time error handling if needed. And everything is automatic. You can
55
- set gorountinen specific asserter with [PushAsserter] function.
57
+ set goroutine specific asserter with [PushAsserter] function.
56
58
57
- You can set the assert package's default asserter with [SetDefault] or
58
- -asserter flag if Go's flag package is in use. This allows developer, operator
59
- and every-day user share the exact same binary but get the error messages and
60
- diagnostic they need.
59
+ The assert package's default asserter you can set with [SetDefault] or -asserter
60
+ flag if Go's flag package (or similar) is in use. This allows developer,
61
+ operator and every-day user share the exact same binary but get the error
62
+ messages and diagnostic they need.
61
63
62
64
// Production asserter adds formatted caller info to normal errors.
63
65
// Information is transported thru error values when err2.Handle is in use.
0 commit comments