~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to test/testunit/util/test_procwrapper.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Author:: Nathaniel Talbott.
 
2
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
 
3
# License:: Ruby license.
 
4
 
 
5
require 'test/unit'
 
6
require 'test/unit/util/procwrapper'
 
7
 
 
8
module Test
 
9
  module Unit
 
10
    module Util
 
11
      class TC_ProcWrapper < TestCase
 
12
        def munge_proc(&a_proc)
 
13
          return a_proc
 
14
        end
 
15
        def setup
 
16
          @original = proc {}
 
17
          @munged = munge_proc(&@original)
 
18
          @wrapped_original = ProcWrapper.new(@original)
 
19
          @wrapped_munged = ProcWrapper.new(@munged)
 
20
        end
 
21
        def test_wrapping
 
22
          assert_same(@original, @wrapped_original.to_proc, "The wrapper should return what was wrapped")
 
23
        end
 
24
        def test_hashing
 
25
      
 
26
          assert_equal(@wrapped_original.hash, @wrapped_munged.hash, "The original and munged should have the same hash when wrapped")
 
27
          assert_equal(@wrapped_original, @wrapped_munged, "The wrappers should be equivalent")
 
28
          
 
29
          a_hash = {@wrapped_original => @original}
 
30
          assert(a_hash[@wrapped_original], "Should be able to access the wrapper in the hash")
 
31
          assert_equal(a_hash[@wrapped_original], @original, "Should be able to access the wrapper in the hash")
 
32
        end
 
33
      end
 
34
    end
 
35
  end
 
36
end