docs(tinyssert): add documentation about msg argument in methods

This commit is contained in:
Guz
2025-05-14 11:30:42 -03:00
parent ceda7536f1
commit 9c59adeba8

View File

@@ -71,6 +71,14 @@ import (
// of this interface can have extra logic on their state such as panicking or using // of this interface can have extra logic on their state such as panicking or using
// [testing.T.FailNow] to halt the program from continuing on failed assertions instead // [testing.T.FailNow] to halt the program from continuing on failed assertions instead
// of just return false. // of just return false.
//
// `msg` argument(s) is(/are) optional, the first argument should always be a string.
// The string can have formatting verbs, with the remaining arguments being used to fill
// those verbs. So for example:
//
// if argument > 0 {
// tinyssert.OK(value, "Since %d is greater than 0, this should always be ok", argument)
// }
type Assertions interface { type Assertions interface {
// Asserts that the object are not zero-valued or nil, aka. "are ok". // Asserts that the object are not zero-valued or nil, aka. "are ok".
OK(obj any, msg ...any) bool OK(obj any, msg ...any) bool