-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcli_test.go
60 lines (48 loc) · 1.54 KB
/
cli_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
56
57
58
59
60
package main
import (
"bytes"
"fmt"
"strings"
"testing"
)
func TestRun_versionFlag(t *testing.T) {
outStream, errStream := new(bytes.Buffer), new(bytes.Buffer)
cli := &CLI{outStream: outStream, errStream: errStream}
args := strings.Split("./sabaviz -version", " ")
status := cli.Run(args)
if status != ExitCodeOK {
t.Errorf("expected %d to eq %d", status, ExitCodeOK)
}
expected := fmt.Sprintf("sabaviz version %s", Version)
if !strings.Contains(errStream.String(), expected) {
t.Errorf("expected %q to eq %q", errStream.String(), expected)
}
}
func TestRun_excludeProcessesFlag(t *testing.T) {
outStream, errStream := new(bytes.Buffer), new(bytes.Buffer)
cli := &CLI{outStream: outStream, errStream: errStream}
args := strings.Split("./sabaviz -exclude-processes", " ")
status := cli.Run(args)
_ = status
}
func TestRun_excludePortsFlag(t *testing.T) {
outStream, errStream := new(bytes.Buffer), new(bytes.Buffer)
cli := &CLI{outStream: outStream, errStream: errStream}
args := strings.Split("./sabaviz -exclude-ports", " ")
status := cli.Run(args)
_ = status
}
func TestRun_userFlag(t *testing.T) {
outStream, errStream := new(bytes.Buffer), new(bytes.Buffer)
cli := &CLI{outStream: outStream, errStream: errStream}
args := strings.Split("./sabaviz -user", " ")
status := cli.Run(args)
_ = status
}
func TestRun_iFlag(t *testing.T) {
outStream, errStream := new(bytes.Buffer), new(bytes.Buffer)
cli := &CLI{outStream: outStream, errStream: errStream}
args := strings.Split("./sabaviz -i", " ")
status := cli.Run(args)
_ = status
}