@@ -7,22 +7,13 @@ import (
77 "testing"
88)
99
10- func TestShouldRunNotChanged (t * testing.T ) {
11- task := Task {
12- Name : "task" ,
13- Command : "run-task" ,
14- }
15-
16- assert .True (t , task .shouldRun (false ), "It runs when not in changed mode" )
17- }
18-
1910func TestShouldRunNotChangedNoFix (t * testing.T ) {
2011 task := Task {
2112 Name : "task" ,
2213 Command : "run-task" ,
2314 }
2415
25- assert .False (t , task .shouldRun (true ), "It does not run when in changed mode with no fix command" )
16+ assert .False (t , task .shouldRun (), "It does not run when in changed mode with no fix command" )
2617}
2718
2819func TestShouldRunNotChangedWithFix (t * testing.T ) {
@@ -32,7 +23,7 @@ func TestShouldRunNotChangedWithFix(t *testing.T) {
3223 }
3324 task .Fix .Command = "run-fix"
3425
35- assert .True (t , task .shouldRun (true ), "It does not run when in changed mode with no fix command" )
26+ assert .True (t , task .shouldRun (), "It does not run when in changed mode with no fix command" )
3627}
3728
3829func TestPrepareCommandNoChangeNoFix (t * testing.T ) {
@@ -43,7 +34,7 @@ func TestPrepareCommandNoChangeNoFix(t *testing.T) {
4334 assert .Equal (
4435 t ,
4536 []string {"run-task" },
46- task .prepareCommand (false , true ),
37+ task .prepareCommand (true ),
4738 "It runs the fix command when fix is true" ,
4839 )
4940}
@@ -55,7 +46,7 @@ func TestPrepareCommandNoChangeFix(t *testing.T) {
5546 assert .Equal (
5647 t ,
5748 []string {"run-fix" },
58- task .prepareCommand (false , true ),
49+ task .prepareCommand (true ),
5950 "It runs the fix command when fix is true" ,
6051 )
6152}
@@ -72,7 +63,7 @@ func TestPrepareCommandWithChanged(t *testing.T) {
7263 assert .Equal (
7364 t ,
7465 []string {"run-task" , "--" , "three.txt" },
75- task .prepareCommand (true , false ),
66+ task .prepareCommand (false ),
7667 "It correctly passes only the relevant files" ,
7768 )
7869}
@@ -145,7 +136,7 @@ func TestExecuteSuccess(t *testing.T) {
145136 Command : "run-task" ,
146137 }
147138
148- result := task .Execute (false , false )
139+ result := task .Execute (false )
149140 assert .True (t , result .success , "The result is successful" )
150141 assert .Equal (t , result .task , task , "It attaches the task" )
151142 assert .Equal (t , result .output , "Output!" , "It attaches the task" )
@@ -161,7 +152,7 @@ func TestExecuteFailure(t *testing.T) {
161152 Command : "run-task" ,
162153 }
163154
164- result := task .Execute (false , false )
155+ result := task .Execute (false )
165156 assert .False (t , result .success , "The result is failed" )
166157 assert .Equal (t , result .task , task , "It attaches the task" )
167158 assert .Equal (t , result .output , "Output!" , "It attaches the task" )
@@ -177,7 +168,7 @@ func TestExecuteFixSuccessNoFixCommand(t *testing.T) {
177168 Command : "run-task" ,
178169 }
179170
180- result := task .Execute (false , true )
171+ result := task .Execute (true )
181172 assert .True (t , result .success , "The result is successful" )
182173 assert .Equal (t , result .task , task , "It attaches the task" )
183174 assert .Equal (t , result .output , "Output!" , "It does not grep through the output" )
@@ -201,7 +192,7 @@ Linted: app/three.rb
201192 task .Fix .Command = "run-fix"
202193 task .Fix .Output = "Fixed:"
203194
204- result := task .Execute (false , true )
195+ result := task .Execute (true )
205196 assert .True (t , result .success , "The result is successful" )
206197 assert .Equal (t , result .task , task , "It attaches the task" )
207198 assert .Equal (t , result .output , "Linted: app/one.rb\n Fixed: app/two.rb\n Linted: app/three.rb\n " , "It attaches the entire output" )
@@ -222,7 +213,7 @@ func TestExecuteFixFailureWithFixCommand(t *testing.T) {
222213 task .Fix .Command = "run-fix"
223214 task .Fix .Output = "Fixed:"
224215
225- result := task .Execute (false , true )
216+ result := task .Execute (true )
226217 assert .False (t , result .success , "The result is successful" )
227218 assert .Equal (t , result .task , task , "It attaches the task" )
228219 assert .Equal (t , result .output , "Failed!" , "It attaches the entire output" )
@@ -250,7 +241,7 @@ Linted: app/three.rb
250241 task .Fix .Command = "run-fix"
251242 task .Fix .Output = "Fixed:"
252243
253- result := task .Execute (false , true )
244+ result := task .Execute (true )
254245 assert .False (t , result .success , "The result is marked unsuccessful so changes can be staged" )
255246 assert .Equal (t , result .task , task , "It attaches the task" )
256247 assert .Equal (t , result .output , "Linted: app/one.rb\n Fixed: app/two.rb\n Linted: app/three.rb\n " , "It attaches the entire output" )
0 commit comments