@@ -6,34 +6,42 @@ import (
66)
77
88func TestPathMatching (t * testing.T ) {
9- job := ParseJobFile ("a_path" , "0 30 * * * * job name " )
9+ job := ParseJobFile ("a_path" , "0 30 * * * * job name .godoit " )
1010 assert .NotNil (t , job , "Failed to parse job" )
1111 assert .Equal (t , "0 30 * * * *" , job .Spec )
1212 assert .Equal (t , "job name" , job .Name )
13- assert .Equal (t , "a_path/0 30 * * * * job name " , job .Filepath )
13+ assert .Equal (t , "a_path/0 30 * * * * job name .godoit" , job .Filepath )
14+ }
15+
16+ func TestPathMatchingWithRepalce (t * testing.T ) {
17+ job := ParseJobFile ("a_path" , "0 30 @ @ @ @ job name.godoit" )
18+ assert .NotNil (t , job , "Failed to parse job" )
19+ assert .Equal (t , "0 30 * * * *" , job .Spec )
20+ assert .Equal (t , "job name" , job .Name )
21+ assert .Equal (t , "a_path/0 30 @ @ @ @ job name.godoit" , job .Filepath )
1422}
1523
1624func TestPathMatching2 (t * testing.T ) {
17- job := ParseJobFile ("a_path" , "* * * * * * TestScanRemoveJob" )
25+ job := ParseJobFile ("a_path" , "* * * * * * TestScanRemoveJob.godoit " )
1826 assert .NotNil (t , job , "Failed to parse job" )
1927}
2028
2129func TestPathAll (t * testing.T ) {
22- job := ParseJobFile ("a_path" , "* * * * * * job name" )
30+ job := ParseJobFile ("a_path" , "* * * * * * job name.godoit " )
2331 assert .NotNil (t , job , "Failed to parse job" )
2432}
2533
2634func TestCommentedOutJobShouldBeNil (t * testing.T ) {
27- job := ParseJobFile ("a_path" , "# 0 30 * * * * job name" )
35+ job := ParseJobFile ("a_path" , "-- 0 30 * * * * job name.godoit " )
2836 assert .Nil (t , job , "Should be nil" )
2937}
3038
3139func TestIncompleteTaskShouldBeNil (t * testing.T ) {
32- job := ParseJobFile ("a_path" , "0 30 * * *" )
40+ job := ParseJobFile ("a_path" , "0 30 * * *.godoit " )
3341 assert .Nil (t , job , "Should be nil" )
3442}
3543
3644func TestWithoutNameShouldBeNil (t * testing.T ) {
37- job := ParseJobFile ("a_path" , "0 30 * * * *" )
45+ job := ParseJobFile ("a_path" , "0 30 * * * *.godoit " )
3846 assert .Nil (t , job , "Should be nil" )
3947}
0 commit comments