@@ -64,41 +64,48 @@ type result struct {
6464}
6565
6666func (r result ) success (t * testing.T ) {
67+ t .Helper ()
6768 assert .Success (t , "execute command" , r .exitErr )
6869}
6970
7071//nolint
7172func (r result ) stdoutContains (t * testing.T , substring string ) {
73+ t .Helper ()
7274 if ! strings .Contains (r .outBuffer .String (), substring ) {
7375 slogtest .Fatal (t , "stdout contains substring" , slog .F ("substring" , substring ), slog .F ("stdout" , r .outBuffer .String ()))
7476 }
7577}
7678
7779//nolint
7880func (r result ) stdoutUnmarshals (t * testing.T , target interface {}) {
81+ t .Helper ()
7982 err := json .Unmarshal (r .outBuffer .Bytes (), target )
8083 assert .Success (t , "unmarshal json" , err )
8184}
8285
8386//nolint
8487func (r result ) stdoutEmpty (t * testing.T ) {
88+ t .Helper ()
8589 assert .Equal (t , "stdout empty" , "" , r .outBuffer .String ())
8690}
8791
8892//nolint
8993func (r result ) stderrEmpty (t * testing.T ) {
94+ t .Helper ()
9095 assert .Equal (t , "stderr empty" , "" , r .errBuffer .String ())
9196}
9297
9398//nolint
9499func (r result ) stderrContains (t * testing.T , substring string ) {
100+ t .Helper ()
95101 if ! strings .Contains (r .errBuffer .String (), substring ) {
96102 slogtest .Fatal (t , "stderr contains substring" , slog .F ("substring" , substring ), slog .F ("stderr" , r .errBuffer .String ()))
97103 }
98104}
99105
100106//nolint
101107func (r result ) clogError (t * testing.T ) clog.CLIError {
108+ t .Helper ()
102109 var cliErr clog.CLIError
103110 if ! xerrors .As (r .exitErr , & cliErr ) {
104111 slogtest .Fatal (t , "expected clog error, none found" , slog .Error (r .exitErr ), slog .F ("type" , fmt .Sprintf ("%T" , r .exitErr )))
@@ -122,8 +129,8 @@ func execute(t *testing.T, in io.Reader, args ...string) result {
122129 err := cmd .Execute ()
123130
124131 slogtest .Debug (t , "execute command" ,
125- slog .F ("outBuffer " , outStream .String ()),
126- slog .F ("errBuffer " , errStream .String ()),
132+ slog .F ("out_buffer " , outStream .String ()),
133+ slog .F ("err_buffer " , errStream .String ()),
127134 slog .F ("args" , args ),
128135 slog .F ("execute_error" , err ),
129136 )
0 commit comments