@@ -35,19 +35,46 @@ func TestCheck(t *testing.T) {
3535
3636 t .Logf ("Running check command w: %t i: %s" , false , "foo,6" )
3737
38- errCode := Check ("" , 0 , true , "csv" , strings .NewReader ("foo,6" ))
38+ errCode := Check ("" , 0 , true , "csv" , false , strings .NewReader ("foo,6" ))
3939
4040 if errCode != 50 {
4141 t .Fatalf ("Check command passed unexpectedly!" )
4242 }
4343
44- errCode = Check ("" , 0 , true , "csv" , strings .NewReader ("foo,6" ))
44+ errCode = Check ("" , 0 , true , "csv" , false , strings .NewReader ("foo,6" ))
4545
4646 if errCode != 50 {
4747 t .Fatalf ("Check command passed unexpectedly!" )
4848 }
4949}
5050
51+ func TestZeroMissing (t * testing.T ) {
52+ if testing .Verbose () {
53+ log .SetLogThreshold (log .LevelInfo )
54+ log .SetStdoutThreshold (log .LevelInfo )
55+ }
56+
57+ createEmptyGitRepo (t )
58+
59+ runCheck (t , true , "foo,5" )
60+
61+ t .Logf ("Running check command w: %t i: %s" , false , "" )
62+
63+ errCode := Check ("" , 0 , true , "csv" , false , strings .NewReader ("" ))
64+
65+ if errCode != 50 {
66+ t .Fatalf ("Check command passed unexpectedly!" )
67+ }
68+
69+ t .Logf ("Running check command zero on missing w: %t i: %s" , false , "" )
70+
71+ errCode = Check ("" , 0 , true , "csv" , false , strings .NewReader ("" ))
72+
73+ if errCode != 0 {
74+ t .Fatalf ("Check command failed unexpectedly!" )
75+ }
76+ }
77+
5178func TestCheckPrefix (t * testing.T ) {
5279 if testing .Verbose () {
5380 log .SetLogThreshold (log .LevelInfo )
@@ -62,7 +89,7 @@ func TestCheckPrefix(t *testing.T) {
6289
6390 t .Logf ("Running check command p: %s w: %t i: %s" , "foobar" , false , "foo,6" )
6491
65- errCode := Check ("foobar" , 0 , false , "csv" , strings .NewReader ("foo,6" ))
92+ errCode := Check ("foobar" , 0 , false , "csv" , false , strings .NewReader ("foo,6" ))
6693
6794 if errCode != 50 {
6895 t .Fatalf ("Check command passed unexpectedly!" )
@@ -84,7 +111,7 @@ func TestCheckSlack(t *testing.T) {
84111
85112 t .Logf ("Running check command p: %s w: %t i: %s" , "pageweight" , false , "gzippedjs,16" )
86113
87- errCode := Check ("pageweight" , slack , false , "csv" , strings .NewReader ("gzippedjs,16" ))
114+ errCode := Check ("pageweight" , slack , false , "csv" , false , strings .NewReader ("gzippedjs,16" ))
88115
89116 if errCode != 50 {
90117 t .Fatalf ("Check command passed unexpectedly!" )
@@ -105,7 +132,7 @@ func TestCheckExcuse(t *testing.T) {
105132
106133 t .Logf ("Running check command p: %s w: %t i: %s" , "foobar" , false , "foo,6" )
107134
108- errCode := Check ("foobar" , 0 , false , "csv" , strings .NewReader ("foo,6" ))
135+ errCode := Check ("foobar" , 0 , false , "csv" , false , strings .NewReader ("foo,6" ))
109136
110137 if errCode != 50 {
111138 t .Fatalf ("Check command passed unexpectedly!" )
@@ -117,7 +144,7 @@ func TestCheckExcuse(t *testing.T) {
117144
118145 t .Logf ("Running check command p: %s w: %t i: %s" , "barfoo" , false , "foo,7" )
119146
120- errCode = Check ("barfoo" , 0 , false , "csv" , strings .NewReader ("foo,7" ))
147+ errCode = Check ("barfoo" , 0 , false , "csv" , false , strings .NewReader ("foo,7" ))
121148
122149 if errCode != 50 {
123150 t .Fatalf ("Check command passed unexpectedly!" )
@@ -138,15 +165,15 @@ func TestCheckWithCheckstyleInput(t *testing.T) {
138165
139166 t .Logf ("Running check command p: %s w: %t i: %s" , "jshint" , true , checkStyleFile )
140167
141- errCode := Check ("jshint" , 0 , true , "checkstyle" , checkStyleFile )
168+ errCode := Check ("jshint" , 0 , true , "checkstyle" , false , checkStyleFile )
142169
143170 if errCode != 0 {
144171 t .Fatalf ("Check command failed! Error code: %d" , errCode )
145172 }
146173
147174 t .Logf ("Running check command p: %s w: %t i: %s" , "jshint" , false , "errors,951" )
148175
149- errCode = Check ("jshint" , 0 , false , "csv" , strings .NewReader ("errors,951" ))
176+ errCode = Check ("jshint" , 0 , false , "csv" , false , strings .NewReader ("errors,951" ))
150177
151178 if errCode != 50 {
152179 t .Fatalf ("Check command passed unexpectedly!" )
@@ -174,7 +201,7 @@ func runCheckP(t *testing.T, prefix string, write bool, input string) {
174201func runCheckPS (t * testing.T , prefix string , slack int , write bool , input string ) {
175202 t .Logf ("Running check command p: %s s: %d, w: %t i: %s" , prefix , slack , write , input )
176203
177- errCode := Check (prefix , slack , write , "csv" , strings .NewReader (input ))
204+ errCode := Check (prefix , slack , write , "csv" , false , strings .NewReader (input ))
178205
179206 if errCode != 0 {
180207 t .Fatalf ("Check command failed! Error code: %d" , errCode )
0 commit comments