Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1015

Show
Ignore:
Timestamp:
10/19/03 00:09:45 (5 years ago)
Author:
nahi
Message:

* added various tests.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/soap/marshal/test_marshal.rb

    r1013 r1015  
    88 
    99module MarshalTestLib 
     10 
     11  module Mod1; end 
     12  module Mod2; end 
     13 
    1014  def encode(o) 
    1115    SOAPMarshal.dump(o) 
     
    5256  end 
    5357 
     58  def test_object_extend 
     59    o1 = Object.new 
     60    o1.extend(Mod1) 
     61    marshal_equal(o1) { |o| 
     62      (class << self; self; end).ancestors 
     63    } 
     64    o1.extend(Mod2) 
     65    marshal_equal(o1) { |o| 
     66      (class << self; self; end).ancestors 
     67    } 
     68  end 
     69 
     70  def test_object_subclass_extend 
     71    o1 = MyObject.new(2) 
     72    o1.extend(Mod1) 
     73    marshal_equal(o1) { |o| 
     74      (class << self; self; end).ancestors 
     75    } 
     76    o1.extend(Mod2) 
     77    marshal_equal(o1) { |o| 
     78      (class << self; self; end).ancestors 
     79    } 
     80  end 
     81 
    5482  class MyArray < Array; def initialize(v, *args) super args; @v = v; end end 
    5583  def test_array 
     
    106134    o1.instance_eval { @iv = 1 } 
    107135    marshal_equal(o1) {|o| o.instance_eval { @iv }} 
     136  end 
     137 
     138  def test_hash_extend 
     139    o1 = Hash.new 
     140    o1.extend(Mod1) 
     141    marshal_equal(o1) { |o| 
     142      (class << self; self; end).ancestors 
     143    } 
     144    o1.extend(Mod2) 
     145    marshal_equal(o1) { |o| 
     146      (class << self; self; end).ancestors 
     147    } 
     148  end 
     149 
     150  def test_hash_subclass_extend 
     151    o1 = MyHash.new(2) 
     152    o1.extend(Mod1) 
     153    marshal_equal(o1) { |o| 
     154      (class << self; self; end).ancestors 
     155    } 
     156    o1.extend(Mod2) 
     157    marshal_equal(o1) { |o| 
     158      (class << self; self; end).ancestors 
     159    } 
    108160  end 
    109161 
     
    142194  end 
    143195 
     196  def test_float_extend 
     197    o1 = 0.0/0.0 
     198    o1.extend(Mod1) 
     199    marshal_equal(o1) { |o| 
     200      (class << self; self; end).ancestors 
     201    } 
     202    o1.extend(Mod2) 
     203    marshal_equal(o1) { |o| 
     204      (class << self; self; end).ancestors 
     205    } 
     206  end 
     207 
    144208  class MyRange < Range; def initialize(v, *args) super(*args); @v = v; end end 
    145209  def test_range 
     
    210274    o1.instance_eval { @iv = 1 } 
    211275    marshal_equal(o1) {|o| o.instance_eval { @iv }} 
     276  end 
     277 
     278  def test_struct_subclass_extend 
     279    o1 = MyStruct.new 
     280    o1.extend(Mod1) 
     281    marshal_equal(o1) { |o| 
     282      (class << self; self; end).ancestors 
     283    } 
     284    o1.extend(Mod2) 
     285    marshal_equal(o1) { |o| 
     286      (class << self; self; end).ancestors 
     287    } 
    212288  end 
    213289 
     
    303379  end 
    304380 
    305   module Mod1 end 
    306   module Mod2 end 
    307381  def test_extend 
    308382    o = Object.new