From f48f4e786b34f378be8e12c40e79f44d902f61d8 Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Tue, 7 May 2024 09:59:39 -0400 Subject: [PATCH] test: add documentation on Checker interface --- test/gadgets_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/gadgets_test.go b/test/gadgets_test.go index e21882805..885736efb 100644 --- a/test/gadgets_test.go +++ b/test/gadgets_test.go @@ -31,6 +31,15 @@ func (s Stream) String() string { panic(fmt.Sprintf("Unknown stream value: %d", s)) } +// Checker represents anything that can be used in conjunction with Assert. +// +// The role of a checker is performing a test on a command's outputs/error, and +// return an error if the test fails. +// +// Note: the Check method is the only required, however during tests the name +// of the checker is printed out in case it fails, so it may be useful to have +// a custom string for this: the `Name() string` method is exactly what to +// implement for this kind of customization. type Checker interface { Check(stdout, stderr string, err error) error }