Tizen 2.1 base
[external/device-mapper.git] / report-generators / test / tc_schedule_file.rb
1 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
2 #
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
6 #
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10
11 require 'test/unit'
12 require 'pathname'
13 require 'schedule_file'
14
15 class TestScheduleFile < Test::Unit::TestCase
16   def test_reading
17     p = Pathname.new("report-generators/test/example.schedule")
18     p.open do |f|
19       s = Schedule.read(p.dirname, f)
20
21       assert_equal(3, s.schedules.size)
22       assert_equal(s.schedules[2].desc, "this comment is prefixed with whitespace")
23       assert_equal(s.schedules[0].command_line, "$TEST_TOOL ls")
24     end
25   end
26
27   def test_running
28     p = Pathname.new("report-generators/test/example.schedule")
29     p.open do |f|
30       s = Schedule.read(p.dirname, f)
31       s.run
32
33       s.schedules.each do |t|
34         assert(t.status.success?)
35       end
36     end
37   end
38 end