~ubuntu-branches/ubuntu/karmic/libcairo-ruby/karmic

« back to all changes in this revision

Viewing changes to test-unit/test/test_pending.rb

  • Committer: Bazaar Package Importer
  • Author(s): Paul van Tilburg, Gunnar Wolf, Paul van Tilburg
  • Date: 2009-05-05 12:14:31 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505121431-n803uyjz51je38l0
Tags: 1.8.0-1
[ Gunnar Wolf ]
* Changed section to Ruby as per ftp-masters' request

[ Paul van Tilburg ]
* New upstream release.
* debian/patches:
  - Dropped patch 01_fix-st.h-ruby1.9-paths: fixed by upstream. 
* debian/control:
  - Bumped standards version to 3.8.1; no changes required.
  - Added ${misc:Depends} to the depends of libcairo-ruby (binary).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'test/unit'
 
2
require 'testunit_test_util'
 
3
 
 
4
class TestUnitPending < Test::Unit::TestCase
 
5
  include TestUnitTestUtil
 
6
 
 
7
  class TestCase < Test::Unit::TestCase
 
8
    class << self
 
9
      def suite
 
10
        Test::Unit::TestSuite.new(name)
 
11
      end
 
12
    end
 
13
 
 
14
    def test_pend
 
15
      pend("1st pend")
 
16
      pend("2nd pend. Should not be reached here.")
 
17
      assert(true, "Should not be reached here too.")
 
18
    end
 
19
 
 
20
    def test_pend_with_failure_in_block
 
21
      pend("Wait a minute") do
 
22
        raise "Not implemented yet"
 
23
      end
 
24
      assert(true, "Reached here.")
 
25
    end
 
26
 
 
27
    def test_pend_with_no_failure_in_block
 
28
      pend("Wait a minute") do
 
29
        "Nothing raised"
 
30
      end
 
31
      assert(true, "Not reached here.")
 
32
    end
 
33
  end
 
34
 
 
35
  def test_pend
 
36
    test = nil
 
37
    result = _run_test("test_pend") {|t| test = t}
 
38
    assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 1 pendings, " \
 
39
                 "0 omissions, 0 notifications",
 
40
                 result.to_s)
 
41
    assert_fault_messages(["1st pend"], result.pendings)
 
42
    assert_true(test.interrupted?)
 
43
  end
 
44
 
 
45
  def test_pend_with_failure_in_block
 
46
    test = nil
 
47
    result = _run_test("test_pend_with_failure_in_block") {|t| test = t}
 
48
    assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 1 pendings, " \
 
49
                 "0 omissions, 0 notifications",
 
50
                 result.to_s)
 
51
    assert_fault_messages(["Wait a minute"], result.pendings)
 
52
    assert_false(test.interrupted?)
 
53
  end
 
54
 
 
55
  def test_pend_with_no_failure_in_block
 
56
    test = nil
 
57
    result = _run_test("test_pend_with_no_failure_in_block") {|t| test = t}
 
58
    assert_equal("1 tests, 1 assertions, 1 failures, 0 errors, 0 pendings, " \
 
59
                 "0 omissions, 0 notifications",
 
60
                 result.to_s)
 
61
    assert_fault_messages(["Pending block should not be passed: Wait a minute."],
 
62
                          result.failures)
 
63
    assert_true(test.interrupted?)
 
64
  end
 
65
 
 
66
  private
 
67
  def _run_test(name, &block)
 
68
    super(TestCase, name, &block)
 
69
  end
 
70
end