-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_test.go
36 lines (31 loc) · 981 Bytes
/
process_test.go
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
32
33
34
35
36
package jasper_test
import (
"context"
"testing"
"github.com/tychoish/jasper/options"
"github.com/tychoish/jasper/testcases"
"github.com/tychoish/jasper/testutil"
)
func TestProcessImplementations(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
for pname, makeProc := range testcases.ProcessConstructors() {
t.Run(pname, func(t *testing.T) {
for optsTestName, modifyOpts := range map[string]func(*options.Create) *options.Create{
"Local": func(opts *options.Create) *options.Create { return opts },
} {
t.Run(optsTestName, func(t *testing.T) {
for testName, testCase := range testcases.ProcessCases() {
t.Run(testName, func(t *testing.T) {
tctx, cancel := context.WithTimeout(ctx, testutil.ProcessTestTimeout)
defer cancel()
opts := &options.Create{Args: []string{"ls"}}
opts = modifyOpts(opts)
testCase(tctx, t, opts, makeProc)
})
}
})
}
})
}
}