Skip to content

Commit 5db4f46

Browse files
committed
Fix test
1 parent be63411 commit 5db4f46

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

main_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bytes"
5+
"io"
56
"testing"
67
)
78

@@ -10,7 +11,14 @@ func TestNtimes(t *testing.T) {
1011
stdout := new(bytes.Buffer)
1112
stderr := new(bytes.Buffer)
1213

13-
ntimes(3, "echo", []string{"foo", "bar", "baz"}, stdin, stdout, stderr)
14+
stdoutCh := make(chan io.ReadWriter)
15+
exitCh := make(chan bool)
16+
17+
go printer(stdout, stdoutCh, exitCh)
18+
19+
ntimes(3, "echo", []string{"foo", "bar", "baz"}, stdin, stdout, stderr, stdoutCh, 1)
20+
21+
exitCh <- true
1422

1523
expected := "foo bar baz\nfoo bar baz\nfoo bar baz\n"
1624
actual := stdout.String()

0 commit comments

Comments
 (0)