forked from DelineaXPM/dsv-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
36 lines (30 loc) · 802 Bytes
/
main_test.go
File metadata and controls
36 lines (30 loc) · 802 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
32
33
34
35
36
package main
import (
"os"
"strconv"
"strings"
"testing"
)
// Test started when the generated test binary is started.
// Use the system test flag so this test is not started directly by go test.
func TestSystem(t *testing.T) {
sysTest := os.Getenv("IS_SYSTEM_TEST")
if sysTest == "" {
return
}
systemTest, err := strconv.ParseBool(sysTest)
if err != nil || !systemTest {
return
}
var args []string
for _, arg := range os.Args {
// Ignore the -test and coverage arguments, these are for the go test binary
// and our CLI will throw errors due to unknown flags.
if strings.HasPrefix(arg, "-test.") || strings.HasSuffix(arg, ".out") {
continue
}
args = append(args, arg)
}
// use the runCLI method. Calling os.Exit() from a test breaks the test
_, _ = runCLI(args)
}