@@ -3,6 +3,8 @@ package main
33import (
44 "reflect"
55 "testing"
6+
7+ "github.com/arschles/assert"
68)
79
810func TestHelpReformatting (t * testing.T ) {
@@ -82,3 +84,50 @@ func TestReplaceShortcutUnchanged(t *testing.T) {
8284 t .Errorf ("Expected %s, Got %s" , expected , actual )
8385 }
8486}
87+
88+ func TestGetConfigFlag (t * testing.T ) {
89+ t .Parallel ()
90+
91+ expected := "the-config-flag"
92+ argv := []string {
93+ "lorem" ,
94+ "ipsum" ,
95+ "--config=" + expected ,
96+ }
97+ actual := getConfigFlag (argv )
98+ assert .Equal (t , actual , expected , "config-flag" )
99+
100+ argv = []string {
101+ "lorem" ,
102+ "ipsum" ,
103+ "-c" ,
104+ expected ,
105+ }
106+ actual = getConfigFlag (argv )
107+ assert .Equal (t , actual , expected , "config-flag" )
108+ }
109+
110+ func TestRemoveConfigFlag (t * testing.T ) {
111+ t .Parallel ()
112+ expected := []string {
113+ "lorem" ,
114+ "ipsum" ,
115+ }
116+
117+ argv := []string {
118+ "lorem" ,
119+ "ipsum" ,
120+ "--config=the-config-flag" ,
121+ }
122+ actual := removeConfigFlag (argv )
123+ assert .Equal (t , actual , expected , "args" )
124+
125+ argv = []string {
126+ "lorem" ,
127+ "ipsum" ,
128+ "-c" ,
129+ "the-config-flag" ,
130+ }
131+ actual = removeConfigFlag (argv )
132+ assert .Equal (t , actual , expected , "args" )
133+ }
0 commit comments