-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_test.go
More file actions
31 lines (25 loc) · 836 Bytes
/
process_test.go
File metadata and controls
31 lines (25 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestStartProcess(t *testing.T) {
p := NewProcess("./testFiles", "python3", []string{"printStdErrStdOut.py"})
err := p.Start()
assert.NoError(t, err)
var outputs []ProcessOutput
for output := range p.Output {
outputs = append(outputs, output)
}
assert.Len(t, outputs, 2, "Expected len(outputs) == 2 but was '%d'", len(outputs))
expectedStdErr := ProcessOutput{
Message: "StdErr Write",
Source: StdErrSource,
}
assert.Containsf(t, outputs, expectedStdErr, "Expected to find StdErr output '%v' in '%v'", outputs, expectedStdErr)
expectedStdOut := ProcessOutput{
Message: "StdOut Write",
Source: StdOutSource,
}
assert.Containsf(t, outputs, expectedStdOut, "Expected to find StdOut output '%v' in '%v'", outputs, expectedStdOut)
}