From 9c59adeba89b7a258c4f590612e9261e18be79d6 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Wed, 14 May 2025 11:30:42 -0300 Subject: [PATCH] docs(tinyssert): add documentation about msg argument in methods --- tinyssert/tinyssert.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tinyssert/tinyssert.go b/tinyssert/tinyssert.go index 87668f8..e9cf1e4 100644 --- a/tinyssert/tinyssert.go +++ b/tinyssert/tinyssert.go @@ -71,6 +71,14 @@ import ( // 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 // 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 { // Asserts that the object are not zero-valued or nil, aka. "are ok". OK(obj any, msg ...any) bool