From 25582aabf49a0f2db08afda0c9ce69877d8ac87a Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Wed, 26 Feb 2025 19:20:19 -0300 Subject: [PATCH] refactor(tinyssert): move NewDisabledAssertions definition closer to disabledAssertions --- tinyssert/tinyssert.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tinyssert/tinyssert.go b/tinyssert/tinyssert.go index bb45bcb..9835f8d 100644 --- a/tinyssert/tinyssert.go +++ b/tinyssert/tinyssert.go @@ -230,14 +230,6 @@ type helperT interface { Helper() } -// Creates a new implementation of Assertions that always return true, with the exception -// of [Assertions.Fail] and [Assertions.FailNow] which returns false, and [Assertions.CallerInfo] -// which returns the actual caller info (uses [CallerInfo] underlying). It is useful it you use -// assertions in production and want to disable them without changing any code. -func NewDisabledAssertions() Assertions { - return &disabledAssertions{} -} - type assertions struct { panic bool @@ -528,6 +520,14 @@ func isTest(name, prefix string) bool { type disabledAssertions struct{} +// Creates a new implementation of Assertions that always return true, with the exception +// of [Assertions.Fail] and [Assertions.FailNow] which returns false, and [Assertions.CallerInfo] +// which returns the actual caller info (uses [CallerInfo] underlying). It is useful it you use +// assertions in production and want to disable them without changing any code. +func NewDisabledAssertions() Assertions { + return &disabledAssertions{} +} + func (*disabledAssertions) OK(any, ...any) bool { return true } func (*disabledAssertions) Equal(_, _ any, _ ...any) bool { return true } func (*disabledAssertions) NotEqual(_, _ any, _ ...any) bool { return true }