@@ -112,6 +112,27 @@ core.AssertPanic(t, func() { panic("test") }, "panic")
112112core.AssertNoPanic (t, func () { /* safe code */ }, " no panic" )
113113```
114114
115+ ** Fatal Assertions (` AssertMust* ` ):**
116+
117+ All ` AssertMustFoo() ` functions call the corresponding ` AssertFoo() ` function
118+ and automatically call ` t.FailNow() ` if the assertion fails, terminating test
119+ execution immediately:
120+
121+ ``` go
122+ // Standard assertions - log failure, test continues
123+ core.AssertEqual (t, expected, actual, " value" )
124+ // ... test execution continues even if assertion fails
125+
126+ // Fatal assertions - log failure, test terminates
127+ core.AssertMustEqual (t, expected, actual, " critical value" )
128+ // ... test execution stops here if assertion fails
129+ ```
130+
131+ ** Key Difference:**
132+
133+ * ` AssertFoo() ` - like ` t.Error() ` , allows test to continue after failure.
134+ * ` AssertMustFoo() ` - like ` t.Fatal() ` , terminates test on failure.
135+
115136### Assertion Function Hierarchy Guidelines
116137
117138When creating custom assertion functions, follow these hierarchy principles.
@@ -151,11 +172,11 @@ func AssertCustomTrue(t core.T, condition bool, name string,
151172
152173** Key Principles:**
153174
154- - ** Avoid circular dependencies** : Don't test assertions using themselves.
155- - ** Maintain consistency** : Derived functions should use base functions for
175+ * ** Avoid circular dependencies** : Don't test assertions using themselves.
176+ * ** Maintain consistency** : Derived functions should use base functions for
156177 uniform error formatting and logging behaviour.
157- - ** Use helper pattern** : Always call ` t.Helper() ` in assertion functions.
158- - ** Follow naming** : Use ` Assert ` prefix and descriptive suffixes.
178+ * ** Use helper pattern** : Always call ` t.Helper() ` in assertion functions.
179+ * ** Follow naming** : Use ` Assert ` prefix and descriptive suffixes.
159180
160181** Understanding Assertion Prefixes:**
161182
@@ -178,10 +199,10 @@ core.AssertTrue(t, SliceContains(got, k), "key %q present", k)
178199
179200** Prefix Guidelines:**
180201
181- - Use ** short, descriptive prefixes** (1-3 words).
182- - The prefix will be combined with the actual value: ` "prefix: value" ` .
183- - For formatted messages, use printf-style formatting: ` "contains %v", key ` .
184- - Avoid complete sentences - they become redundant with the logged value.
202+ * Use ** short, descriptive prefixes** (1-3 words).
203+ * The prefix will be combined with the actual value: ` "prefix: value" ` .
204+ * For formatted messages, use printf-style formatting: ` "contains %v", key ` .
205+ * Avoid complete sentences - they become redundant with the logged value.
185206
186207## COMPLIANT Test Structure Patterns
187208
@@ -916,11 +937,11 @@ Run with: `go test -tags=integration`
916937
917938### Test Naming
918939
919- - Test functions: ` TestFunctionName ` .
920- - Test types: ` functionNameTestCase ` .
921- - TestCase interface methods:
922- - ` func (tc testCaseType) Name() string ` - returns test case name
923- - ` func (tc testCaseType) Test(t *testing.T) ` - runs the test logic
940+ * Test functions: ` TestFunctionName ` .
941+ * Test types: ` functionNameTestCase ` .
942+ * TestCase interface methods:
943+ * ` func (tc testCaseType) Name() string ` - returns test case name
944+ * ` func (tc testCaseType) Test(t *testing.T) ` - runs the test logic
924945
925946### Documentation
926947
@@ -943,11 +964,11 @@ func (tc parseURLTestCase) Test(t *testing.T) {
943964
944965### Clean Tests
945966
946- - Use ` t.Helper() ` in all helper functions.
947- - Prefer table-driven tests over individual test functions.
948- - Keep setup and clean-up minimal.
949- - Use meaningful assertion descriptions.
950- - Test both success and failure paths.
967+ * Use ` t.Helper() ` in all helper functions.
968+ * Prefer table-driven tests over individual test functions.
969+ * Keep setup and clean-up minimal.
970+ * Use meaningful assertion descriptions.
971+ * Test both success and failure paths.
951972
952973### Test Data
953974
@@ -1101,28 +1122,28 @@ func validationTestCases(fieldName string) []validationTestCase {
11011122
11021123Before committing test code, verify ALL 6 requirements:
11031124
1104- - [ ] ** TestCase Interface Validations** : Added ` var _ TestCase = ... ` for
1125+ * [ ] ** TestCase Interface Validations** : Added ` var _ TestCase = ... ` for
11051126 all test case types
1106- - [ ] ** Factory Functions** : Created ` newTestCaseTypeName() ` for all test
1127+ * [ ] ** Factory Functions** : Created ` newTestCaseTypeName() ` for all test
11071128 case types
1108- - [ ] ** Factory Usage** : All test case declarations use factory functions
1129+ * [ ] ** Factory Usage** : All test case declarations use factory functions
11091130 (no naked struct literals)
1110- - [ ] ** RunTestCases Usage** : All test functions use ` RunTestCases(t, cases) `
1111- - [ ] ** Anonymous Functions** : No ` t.Run() ` anonymous functions longer than
1131+ * [ ] ** RunTestCases Usage** : All test functions use ` RunTestCases(t, cases) `
1132+ * [ ] ** Anonymous Functions** : No ` t.Run() ` anonymous functions longer than
11121133 3 lines
1113- - [ ] ** Test Case List Factories** : Complex test case generation uses
1134+ * [ ] ** Test Case List Factories** : Complex test case generation uses
11141135 ` myFooTestCases() ` factory functions
11151136
11161137## Summary
11171138
11181139By following these ** MANDATORY** guidelines, all darvaza.org projects will
11191140have:
11201141
1121- - ** Consistent testing patterns** across the entire ecosystem.
1122- - ** Lint-compliant code** that meets complexity requirements.
1123- - ** Maintainable tests** that are easy to read and modify.
1124- - ** Reliable test suites** with excellent error reporting.
1125- - ** Comprehensive coverage** with meaningful assertions.
1142+ * ** Consistent testing patterns** across the entire ecosystem.
1143+ * ** Lint-compliant code** that meets complexity requirements.
1144+ * ** Maintainable tests** that are easy to read and modify.
1145+ * ** Reliable test suites** with excellent error reporting.
1146+ * ** Comprehensive coverage** with meaningful assertions.
11261147
11271148The key is to treat test code with the same care as production code, using
11281149the excellent utilities provided by ` darvaza.org/core ` to maintain
0 commit comments