diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-26 22:23:58 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-26 22:24:16 +0700 |
| commit | f2b0021604e898e78ad53100057fd7da0b2187a6 (patch) | |
| tree | 3aa3dd21cc38261b4a38c6056813d53235fecb48 /awwan_play_test.go | |
| parent | f2da8879166f60ec65671afaebc18b2c4dbb918a (diff) | |
| download | awwan-f2b0021604e898e78ad53100057fd7da0b2187a6.tar.xz | |
all: use "mlog.MultiLogger" to log Request output and error
By using "mlog.MultiLogger" every output or error can be written to
stdout/stderr and additional log writer that can collect both of them,
buffered and returned to the caller.
This changes simplify the HttpResponse to use only single output that
combine both stdout and stderr.
Diffstat (limited to 'awwan_play_test.go')
| -rw-r--r-- | awwan_play_test.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/awwan_play_test.go b/awwan_play_test.go index 3026472..e73faf4 100644 --- a/awwan_play_test.go +++ b/awwan_play_test.go @@ -51,24 +51,20 @@ func TestAwwan_Play_withLocal(t *testing.T) { } var ( - req = NewRequest(CommandModePlay, scriptFile, `1-`) - mockout = bytes.Buffer{} - mockerr = bytes.Buffer{} + req = NewRequest(CommandModePlay, scriptFile, `1-`) + + logw bytes.Buffer ) - req.stdout = &mockout - req.stderr = &mockerr + req.registerLogWriter(`output`, &logw) err = aww.Play(req) if err != nil { t.Fatal(err) } - var exp = string(tdata.Output[`play_with_local:stdout`]) - test.Assert(t, `stdout`, exp, mockout.String()) - - exp = string(tdata.Output[`play_with_local:stderr`]) - test.Assert(t, `stderr`, exp, mockerr.String()) + var exp = string(tdata.Output[`play_with_local:output`]) + test.Assert(t, `output`, exp, logw.String()) } func TestAwwan_Play_Get(t *testing.T) { |
