-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeis_test.go
69 lines (51 loc) · 1.3 KB
/
deis_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
61
62
63
64
65
66
67
68
69
package main
import (
"reflect"
"testing"
)
func TestHelpReformatting(t *testing.T) {
t.Parallel()
tests := []string{"--help", "-h", "help"}
expected := "help"
for _, test := range tests {
actual := parseArgs([]string{test})
if actual[0] != expected {
t.Errorf("Expected %s, Got %s", expected, actual[0])
}
}
}
func TestHelpReformattingWithCommand(t *testing.T) {
t.Parallel()
tests := []string{"--help", "-h", "help"}
expected := "--help"
for _, test := range tests {
actual := parseArgs([]string{test, "test"})
if actual[1] != expected {
t.Errorf("Expected %s, Got %s", expected, actual[1])
}
}
}
func TestCommandSplitting(t *testing.T) {
t.Parallel()
expected := []string{"apps", "create", "test", "foo"}
actual := parseArgs([]string{"apps:create", "test", "foo"})
if !reflect.DeepEqual(expected, actual) {
t.Errorf("Expected %v, Got %v", expected, actual)
}
}
func TestReplaceShortcutRepalce(t *testing.T) {
t.Parallel()
expected := "apps:create"
actual := replaceShortcut("create")
if expected != actual {
t.Errorf("Expected %s, Got %s", expected, actual)
}
}
func TestReplaceShortcutUnchanged(t *testing.T) {
t.Parallel()
expected := "users:list"
actual := replaceShortcut(expected)
if expected != actual {
t.Errorf("Expected %s, Got %s", expected, actual)
}
}