@@ -169,8 +169,9 @@ const (
169
169
// })
170
170
// }
171
171
//
172
- // Because PushTester returns PopTester it allows us to merge these two calls to
173
- // one line. See the first t.Run call above. See more information in PopTester.
172
+ // Because PushTester returns [PopTester] it allows us to merge these two calls
173
+ // to one line. See the first t.Run call above. See more information in
174
+ // [PopTester].
174
175
//
175
176
// PushTester allows you to change the current default asserter by accepting it
176
177
// as a second argument.
@@ -200,7 +201,7 @@ func PushTester(t testing.TB, a ...defInd) function {
200
201
// memory cleanup and adding similar to err2.Catch error/panic safety for tests.
201
202
// By using PopTester you get error logs tuned for unit testing.
202
203
//
203
- // You have two ways to call PopTester. With defer right after PushTester:
204
+ // You have two ways to call [ PopTester] . With defer right after [ PushTester] :
204
205
//
205
206
// for _, tt := range tests {
206
207
// t.Run(tt.name, func(t *testing.T) {
@@ -211,7 +212,7 @@ func PushTester(t testing.TB, a ...defInd) function {
211
212
// })
212
213
// }
213
214
//
214
- // If you want to have one liner to combine Push/ PopTester:
215
+ // If you want, you can combine [PushTester] and PopTester to one-liner :
215
216
//
216
217
// defer assert.PushTester(t)()
217
218
func PopTester () {
@@ -240,7 +241,7 @@ func PopTester() {
240
241
// First, print the call stack. Note, that we aren't support full error
241
242
// tracing with unit test logging. However, using it has proved the top
242
243
// level error stack as more enough. Even so that we could consider using
243
- // it for normal error stack straces if it would be possible.
244
+ // it for normal error stack traces if it would be possible.
244
245
const stackLvl = 6 // amount of functions before we're here
245
246
debug .PrintStackForTest (os .Stderr , stackLvl )
246
247
@@ -302,9 +303,8 @@ func Nil[T any](p *T, a ...any) {
302
303
// (default Asserter) with the given message.
303
304
//
304
305
// Note, use this only for real interface types. Go's interface's has two values
305
- // so this won't work e.g. slices! Read more information about interface type.
306
- //
307
- // https://go.dev/doc/faq#nil_error
306
+ // so this won't work e.g. slices! Read more information about interface type:
307
+ // https://go.dev/doc/faq#nil_error.
308
308
func INil (i any , a ... any ) {
309
309
if i != nil {
310
310
defMsg := assertionMsg + ": interface should be nil"
@@ -316,9 +316,8 @@ func INil(i any, a ...any) {
316
316
// panics/errors (default Asserter) with the given message.
317
317
//
318
318
// Note, use this only for real interface types. Go's interface's has two values
319
- // so this won't work e.g. slices! Read more information about interface type.
320
- //
321
- // https://go.dev/doc/faq#nil_error
319
+ // so this won't work e.g. slices! Read more information about interface type:
320
+ // https://go.dev/doc/faq#nil_error.
322
321
func INotNil (i any , a ... any ) {
323
322
if i == nil {
324
323
defMsg := assertionMsg + ": interface shouldn't be nil"
@@ -414,7 +413,7 @@ func NotDeepEqual(val, want any, a ...any) {
414
413
// message. You can append the generated got-want message by using optional
415
414
// message arguments.
416
415
//
417
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
416
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
418
417
// inlining for the current implementation of Go's type parametric functions.
419
418
func Len (obj string , length int , a ... any ) {
420
419
l := len (obj )
@@ -430,7 +429,7 @@ func Len(obj string, length int, a ...any) {
430
429
// message. You can append the generated got-want message by using optional
431
430
// message arguments.
432
431
//
433
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
432
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
434
433
// inlining for the current implementation of Go's type parametric functions.
435
434
func Longer (s string , length int , a ... any ) {
436
435
l := len (s )
@@ -446,7 +445,7 @@ func Longer(s string, length int, a ...any) {
446
445
// message. You can append the generated got-want message by using optional
447
446
// message arguments.
448
447
//
449
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
448
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
450
449
// inlining for the current implementation of Go's type parametric functions.
451
450
func Shorter (str string , length int , a ... any ) {
452
451
l := len (str )
@@ -462,7 +461,7 @@ func Shorter(str string, length int, a ...any) {
462
461
// message. You can append the generated got-want message by using optional
463
462
// message arguments.
464
463
//
465
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
464
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
466
465
// inlining for the current implementation of Go's type parametric functions.
467
466
func SLen [S ~ []T , T any ](obj S , length int , a ... any ) {
468
467
l := len (obj )
@@ -478,7 +477,7 @@ func SLen[S ~[]T, T any](obj S, length int, a ...any) {
478
477
// message. You can append the generated got-want message by using optional
479
478
// message arguments.
480
479
//
481
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
480
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
482
481
// inlining for the current implementation of Go's type parametric functions.
483
482
func SLonger [S ~ []T , T any ](obj S , length int , a ... any ) {
484
483
l := len (obj )
@@ -494,7 +493,7 @@ func SLonger[S ~[]T, T any](obj S, length int, a ...any) {
494
493
// message. You can append the generated got-want message by using optional
495
494
// message arguments.
496
495
//
497
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
496
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
498
497
// inlining for the current implementation of Go's type parametric functions.
499
498
func SShorter [S ~ []T , T any ](obj S , length int , a ... any ) {
500
499
l := len (obj )
@@ -510,7 +509,7 @@ func SShorter[S ~[]T, T any](obj S, length int, a ...any) {
510
509
// message. You can append the generated got-want message by using optional
511
510
// message arguments.
512
511
//
513
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
512
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
514
513
// inlining for the current implementation of Go's type parametric functions.
515
514
func MLen [M ~ map [T ]U , T comparable , U any ](obj M , length int , a ... any ) {
516
515
l := len (obj )
@@ -526,7 +525,7 @@ func MLen[M ~map[T]U, T comparable, U any](obj M, length int, a ...any) {
526
525
// message. You can append the generated got-want message by using optional
527
526
// message arguments.
528
527
//
529
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
528
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
530
529
// inlining for the current implementation of Go's type parametric functions.
531
530
func MLonger [M ~ map [T ]U , T comparable , U any ](obj M , length int , a ... any ) {
532
531
l := len (obj )
@@ -542,7 +541,7 @@ func MLonger[M ~map[T]U, T comparable, U any](obj M, length int, a ...any) {
542
541
// message. You can append the generated got-want message by using optional
543
542
// message arguments.
544
543
//
545
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
544
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
546
545
// inlining for the current implementation of Go's type parametric functions.
547
546
func MShorter [M ~ map [T ]U , T comparable , U any ](obj M , length int , a ... any ) {
548
547
l := len (obj )
@@ -558,7 +557,7 @@ func MShorter[M ~map[T]U, T comparable, U any](obj M, length int, a ...any) {
558
557
// message. You can append the generated got-want message by using optional
559
558
// message arguments.
560
559
//
561
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
560
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
562
561
// inlining for the current implementation of Go's type parametric functions.
563
562
func CLen [C ~ chan T , T any ](obj C , length int , a ... any ) {
564
563
l := len (obj )
@@ -574,7 +573,7 @@ func CLen[C ~chan T, T any](obj C, length int, a ...any) {
574
573
// message. You can append the generated got-want message by using optional
575
574
// message arguments.
576
575
//
577
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
576
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
578
577
// inlining for the current implementation of Go's type parametric functions.
579
578
func CLonger [C ~ chan T , T any ](obj C , length int , a ... any ) {
580
579
l := len (obj )
@@ -590,7 +589,7 @@ func CLonger[C ~chan T, T any](obj C, length int, a ...any) {
590
589
// message. You can append the generated got-want message by using optional
591
590
// message arguments.
592
591
//
593
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
592
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
594
593
// inlining for the current implementation of Go's type parametric functions.
595
594
func CShorter [C ~ chan T , T any ](obj C , length int , a ... any ) {
596
595
l := len (obj )
@@ -638,7 +637,7 @@ func Empty(obj string, a ...any) {
638
637
// (according the current Asserter) with the auto-generated message. You can
639
638
// append the generated got-want message by using optional message arguments.
640
639
//
641
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
640
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
642
641
// inlining for the current implementation of Go's type parametric functions.
643
642
func SNotEmpty [S ~ []T , T any ](obj S , a ... any ) {
644
643
l := len (obj )
@@ -655,7 +654,7 @@ func SNotEmpty[S ~[]T, T any](obj S, a ...any) {
655
654
// You can append the generated got-want message by using optional message
656
655
// arguments.
657
656
//
658
- // Note! This is reasonably fast but not as fast as ' That' because of lacking
657
+ // Note! This is reasonably fast but not as fast as [ That] because of lacking
659
658
// inlining for the current implementation of Go's type parametric functions.
660
659
func MNotEmpty [M ~ map [T ]U , T comparable , U any ](obj M , a ... any ) {
661
660
l := len (obj )
@@ -670,14 +669,15 @@ func MNotEmpty[M ~map[T]U, T comparable, U any](obj M, a ...any) {
670
669
// formatting string. Thanks to inlining, the performance penalty is equal to a
671
670
// single 'if-statement' that is almost nothing.
672
671
//
673
- // Note. We recommend that you prefer try.To. They work exactly the same during
672
+ // Note. We recommend that you prefer [ try.To] . They work exactly the same during
674
673
// the test runs and you can use the same code for both: runtime and tests.
675
674
// However, there are cases that you want assert that there is no error in cases
676
675
// where fast fail and immediate stop of execution is wanted at runtime. With
677
- // asserts you get the file location as well. (See the asserters).
676
+ // asserts ([Production], [Development], [Debug]) you get the file location as
677
+ // well.
678
678
func NoError (err error , a ... any ) {
679
679
if err != nil {
680
- defMsg := "NoError:" + assertionMsg + conCatErrStr + err .Error ()
680
+ defMsg := assertionMsg + conCatErrStr + err .Error ()
681
681
current ().reportAssertionFault (defMsg , a )
682
682
}
683
683
}
0 commit comments