generated from xmidt-org/.go-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_test.go
55 lines (46 loc) · 1.12 KB
/
main_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"strconv"
"testing"
"github.com/stretchr/testify/suite"
)
type NewAppSuite struct {
DMSSuite
validParameters [][]string
invalidParameters [][]string
}
func (suite *NewAppSuite) SetupSuite() {
suite.validParameters = [][]string{
{"--exec", "echo 'hi'"},
{"--exec", "echo 'hi'", "--ttl", "10s", "--misses", "4"},
{"--exec", "echo 'hi'", "--exec", "echo 'another'", "--ttl", "12h", "--misses", "2", "--debug"},
}
suite.invalidParameters = [][]string{
{},
{"--foobar"},
{"--exec", "echo 'hi'", "--foobar"},
}
}
func (suite *NewAppSuite) TestNewApp() {
suite.Run("Valid", func() {
for i, validParameters := range suite.validParameters {
suite.Run(strconv.Itoa(i), func() {
app := newApp(validParameters)
suite.Require().NotNil(app)
suite.NoError(app.Err())
})
}
})
suite.Run("Invalid", func() {
for i, invalidParameters := range suite.invalidParameters {
suite.Run(strconv.Itoa(i), func() {
app := newApp(invalidParameters)
suite.Require().NotNil(app)
suite.Error(app.Err())
})
}
})
}
func TestNewApp(t *testing.T) {
suite.Run(t, new(NewAppSuite))
}