From 43a8b0afb4f9884300907b20b86fc093094b0134 Mon Sep 17 00:00:00 2001 From: pfinch Date: Thu, 6 Jun 2024 09:22:31 +1000 Subject: [PATCH] updating NoFieldIsEmpty documentation --- assert/assertion_format.go | 4 +++- assert/assertion_forward.go | 8 ++++++-- assert/assertions.go | 4 +++- require/require.go | 8 ++++++-- require/require_forward.go | 8 ++++++-- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/assert/assertion_format.go b/assert/assertion_format.go index db74b8eb3..6a2c9f0c0 100644 --- a/assert/assertion_format.go +++ b/assert/assertion_format.go @@ -546,7 +546,9 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { return NoError(t, err, append([]interface{}{msg}, args...)...) } -// NoFieldIsEmptyf asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmptyf asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func NoFieldIsEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/assert/assertion_forward.go b/assert/assertion_forward.go index 7440d4bbd..0856b03dc 100644 --- a/assert/assertion_forward.go +++ b/assert/assertion_forward.go @@ -1084,7 +1084,9 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { return NoErrorf(a.t, err, msg, args...) } -// NoFieldIsEmpty asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmpty asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func (a *Assertions) NoFieldIsEmpty(object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1092,7 +1094,9 @@ func (a *Assertions) NoFieldIsEmpty(object interface{}, msgAndArgs ...interface{ return NoFieldIsEmpty(a.t, object, msgAndArgs...) } -// NoFieldIsEmptyf asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmptyf asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func (a *Assertions) NoFieldIsEmptyf(object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/assert/assertions.go b/assert/assertions.go index efbf7e6c4..3ccf33019 100644 --- a/assert/assertions.go +++ b/assert/assertions.go @@ -2149,7 +2149,9 @@ func buildErrorChainString(err error) string { return chain } -// NoFieldIsEmpty asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmpty asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func NoFieldIsEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { if reflect.TypeOf(object).Kind() == reflect.Ptr { return NoFieldIsEmpty(t, reflect.ValueOf(object).Elem().Interface(), msgAndArgs) diff --git a/require/require.go b/require/require.go index 6541d517f..00c362b5d 100644 --- a/require/require.go +++ b/require/require.go @@ -1373,7 +1373,9 @@ func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { t.FailNow() } -// NoFieldIsEmpty asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmpty asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func NoFieldIsEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1384,7 +1386,9 @@ func NoFieldIsEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { t.FailNow() } -// NoFieldIsEmptyf asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmptyf asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func NoFieldIsEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/require/require_forward.go b/require/require_forward.go index a5d0bd101..a2a37a3b7 100644 --- a/require/require_forward.go +++ b/require/require_forward.go @@ -1085,7 +1085,9 @@ func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { NoErrorf(a.t, err, msg, args...) } -// NoFieldIsEmpty asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmpty asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func (a *Assertions) NoFieldIsEmpty(object interface{}, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1093,7 +1095,9 @@ func (a *Assertions) NoFieldIsEmpty(object interface{}, msgAndArgs ...interface{ NoFieldIsEmpty(a.t, object, msgAndArgs...) } -// NoFieldIsEmptyf asserts that object, which must be a struct or eventually reference to one, has no empty exported fields. +// NoFieldIsEmptyf asserts that object, which must be a struct or eventually +// reference to one, has no exported field with a value that is empty (following +// the definition of empty used in [Empty]). func (a *Assertions) NoFieldIsEmptyf(object interface{}, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper()