test/cronline_test.rb in rufus-scheduler-1.0.5 vs test/cronline_test.rb in rufus-scheduler-1.0.6
- old
+ new
@@ -16,40 +16,46 @@
#
# testing the Scheduler's CronLine system
#
class CronLineTest < Test::Unit::TestCase
- #def setup
- #end
+ #def setup
+ #end
- #def teardown
- #end
+ #def teardown
+ #end
- def test_0
+ def test_0
- dotest "* * * * *", [ [0], nil, nil, nil, nil, nil ]
- dotest "10-12 * * * *", [ [0], [10, 11, 12], nil, nil, nil, nil ]
- dotest "* * * * sun,mon", [ [0], nil, nil, nil, nil, [7, 1] ]
- dotest "* * * * mon-wed", [ [0], nil, nil, nil, nil, [1, 2, 3] ]
+ dotest "* * * * *", [ [0], nil, nil, nil, nil, nil ]
+ dotest "10-12 * * * *", [ [0], [10, 11, 12], nil, nil, nil, nil ]
+ dotest "* * * * sun,mon", [ [0], nil, nil, nil, nil, [0, 1] ]
+ dotest "* * * * mon-wed", [ [0], nil, nil, nil, nil, [1, 2, 3] ]
+ dotest "* * * * 7", [ [0], nil, nil, nil, nil, [0] ]
+ dotest "* * * * 0", [ [0], nil, nil, nil, nil, [0] ]
+ dotest "* * * * 0,1", [ [0], nil, nil, nil, nil, [0,1] ]
+ dotest "* * * * 7,1", [ [0], nil, nil, nil, nil, [0,1] ]
+ dotest "* * * * 7,0", [ [0], nil, nil, nil, nil, [0] ]
+ dotest "* * * * sun,2-4", [ [0], nil, nil, nil, nil, [0, 2, 3, 4] ]
- #dotest "* * * * sun,mon-tue", [ [0], nil, nil, nil, nil, [7, 1, 2] ]
- #dotest "* * * * 7-1", [ [0], nil, nil, nil, nil, [7, 1, 2] ]
- end
+ dotest "* * * * sun,mon-tue", [ [0], nil, nil, nil, nil, [0, 1, 2] ]
+ #dotest "* * * * 7-1", [ [0], nil, nil, nil, nil, [0, 1, 2] ]
+ end
- def test_1
+ def test_1
- dotest "* * * * * *", [ nil, nil, nil, nil, nil, nil ]
- dotest "1 * * * * *", [ [1], nil, nil, nil, nil, nil ]
- dotest "7 10-12 * * * *", [ [7], [10, 11, 12], nil, nil, nil, nil ]
- dotest "1-5 * * * * *", [ [1,2,3,4,5], nil, nil, nil, nil, nil ]
- end
+ dotest "* * * * * *", [ nil, nil, nil, nil, nil, nil ]
+ dotest "1 * * * * *", [ [1], nil, nil, nil, nil, nil ]
+ dotest "7 10-12 * * * *", [ [7], [10, 11, 12], nil, nil, nil, nil ]
+ dotest "1-5 * * * * *", [ [1,2,3,4,5], nil, nil, nil, nil, nil ]
+ end
- protected
+ protected
- def dotest (line, array)
+ def dotest (line, array)
- cl = Rufus::CronLine.new(line)
+ cl = Rufus::CronLine.new(line)
- assert_equal array, cl.to_array
- end
+ assert_equal array, cl.to_array
+ end
end