@@ -33,12 +33,17 @@ func TestReportDefaultOptions(t *testing.T) {
3333 ui := new (cli.MockUi )
3434 c := ReportCmd {Ui : ui }
3535
36- args := []string {"" }
36+ args := []string {"-testing=true " }
3737 rc := c .Run (args )
3838
3939 if rc != 0 {
4040 t .Errorf ("gtm report(%+v), want 0 got %d, %s" , args , rc , ui .ErrorWriter .String ())
4141 }
42+
43+ want := "2m 40s 89% [m] event/event.go"
44+ if ! strings .Contains (ui .OutputWriter .String (), want ) {
45+ t .Errorf ("gtm report(%+v), want %s got %s, %s" , args , want , ui .OutputWriter .String (), ui .ErrorWriter .String ())
46+ }
4247}
4348
4449func TestReportSummary (t * testing.T ) {
@@ -63,12 +68,17 @@ func TestReportSummary(t *testing.T) {
6368 ui := new (cli.MockUi )
6469 c := ReportCmd {Ui : ui }
6570
66- args := []string {"-format" , "summary" }
71+ args := []string {"-format" , "summary" , "-testing=true" }
6772 rc := c .Run (args )
6873
6974 if rc != 0 {
7075 t .Errorf ("gtm report(%+v), want 0 got %d, %s" , args , rc , ui .ErrorWriter .String ())
7176 }
77+
78+ want := "3m 0s This is a commit"
79+ if ! strings .Contains (ui .OutputWriter .String (), want ) {
80+ t .Errorf ("gtm report(%+v), want %s got %s, %s" , args , want , ui .OutputWriter .String (), ui .ErrorWriter .String ())
81+ }
7282}
7383
7484func TestReportAll (t * testing.T ) {
@@ -93,6 +103,7 @@ func TestReportAll(t *testing.T) {
93103 ui := new (cli.MockUi )
94104 c := ReportCmd {Ui : ui }
95105
106+ // TODO: in order to test output of multi-project reporting, we need the ability to mock the project index
96107 args := []string {"-all" }
97108 rc := c .Run (args )
98109
@@ -123,12 +134,17 @@ func TestReportTimelineHours(t *testing.T) {
123134 ui := new (cli.MockUi )
124135 c := ReportCmd {Ui : ui }
125136
126- args := []string {"-format" , "timeline-hours" }
137+ args := []string {"-format" , "timeline-hours" , "-testing=true" }
127138 rc := c .Run (args )
128139
129140 if rc != 0 {
130141 t .Errorf ("gtm report(%+v), want 0 got %d, %s" , args , rc , ui .ErrorWriter .String ())
131142 }
143+
144+ want := "Sun Mar 20"
145+ if ! strings .Contains (ui .OutputWriter .String (), want ) {
146+ t .Errorf ("gtm report(%+v), want %s got %s, %s" , args , want , ui .OutputWriter .String (), ui .ErrorWriter .String ())
147+ }
132148}
133149
134150func TestReportTimelineCommits (t * testing.T ) {
@@ -153,12 +169,17 @@ func TestReportTimelineCommits(t *testing.T) {
153169 ui := new (cli.MockUi )
154170 c := ReportCmd {Ui : ui }
155171
156- args := []string {"-format" , "timeline-commits" }
172+ args := []string {"-format" , "timeline-commits" , "-testing=true" }
157173 rc := c .Run (args )
158174
159175 if rc != 0 {
160176 t .Errorf ("gtm report(%+v), want 0 got %d, %s" , args , rc , ui .ErrorWriter .String ())
161177 }
178+
179+ want := "Wed Mar 06"
180+ if ! strings .Contains (ui .OutputWriter .String (), want ) {
181+ t .Errorf ("gtm report(%+v), want %s got %s, %s" , args , want , ui .OutputWriter .String (), ui .ErrorWriter .String ())
182+ }
162183}
163184
164185func TestReportFiles (t * testing.T ) {
@@ -183,12 +204,17 @@ func TestReportFiles(t *testing.T) {
183204 ui := new (cli.MockUi )
184205 c := ReportCmd {Ui : ui }
185206
186- args := []string {"-format" , "files" }
207+ args := []string {"-format" , "files" , "-testing=true" }
187208 rc := c .Run (args )
188209
189210 if rc != 0 {
190211 t .Errorf ("gtm report(%+v), want 0 got %d, %s" , args , rc , ui .ErrorWriter .String ())
191212 }
213+
214+ want := "3m 0s"
215+ if ! strings .Contains (ui .OutputWriter .String (), want ) {
216+ t .Errorf ("gtm report(%+v), want %s got %s, %s" , args , want , ui .OutputWriter .String (), ui .ErrorWriter .String ())
217+ }
192218}
193219
194220func TestReportInvalidOption (t * testing.T ) {
0 commit comments