diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-08 09:52:42 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-08 09:52:42 +0000 |
commit | b7931c40fee8ec76c2ef0398f228e034d7ff64e4 (patch) | |
tree | 4455d91a96cc91f03858ef6c517e9b7d7dbbf119 /test/soap | |
parent | 2c35c4254e36cb3c59acfb50b738930c49cfd3af (diff) |
* test/wsdl/raa/*: add new testcase for WSDL loading, parsing and reading.
* test/soap/marshal/*: backport from soap4r/1.5.1. all differences are for
ruby/1.6.
* lib/soap/*: backport from soap4r/1.5.1. all differences are for ruby/1.6.
* lib/wsdl/data.rb, lib/wsdl/xmlSchema/data.rb: move definition of
ArrayTypeAttrName from ::WSDL::XMLSchema::* to ::WSDL::*. [ruby-talk:84813]
* lib/wsdl/soap/definitions.rb: element name typo in custom exception struct
definition which is needed for wsdlDriver; camelCase -> underscore_name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/soap')
-rw-r--r-- | test/soap/marshal/test_digraph.rb | 4 | ||||
-rw-r--r-- | test/soap/marshal/test_marshal.rb | 59 |
2 files changed, 53 insertions, 10 deletions
diff --git a/test/soap/marshal/test_digraph.rb b/test/soap/marshal/test_digraph.rb index c83238748a..d7f30654f8 100644 --- a/test/soap/marshal/test_digraph.rb +++ b/test/soap/marshal/test_digraph.rb @@ -36,7 +36,9 @@ class TestDigraph < Test::Unit::TestCase f = File.open("digraph_marshalled_string.soap", "wb") SOAP::Marshal.dump(@n1, f) f.close - str = File.read("digraph_marshalled_string.soap") + f = File.open("digraph_marshalled_string.soap") + str = f.read + f.close newnode = SOAP::Marshal.unmarshal(str) assert_equal(newnode.first.first.__id__, newnode.second.first.__id__) assert_equal(newnode.first.first.first.first.__id__, newnode.second.first.second.first.__id__) diff --git a/test/soap/marshal/test_marshal.rb b/test/soap/marshal/test_marshal.rb index 2763fa8bcf..9ae08c68d8 100644 --- a/test/soap/marshal/test_marshal.rb +++ b/test/soap/marshal/test_marshal.rb @@ -78,13 +78,18 @@ module MarshalTestLib } end - class MyArray < Array; def initialize(v, *args) super args; @v = v; end end + class MyArray < Array + def initialize(v, args) + super(args) + @v = v + end + end def test_array - marshal_equal([1,2,3]) + marshal_equal(5) end def test_array_subclass - marshal_equal(MyArray.new(0, 1,2,3)) + marshal_equal(MyArray.new(0, 3)) end def test_array_ivar @@ -166,7 +171,8 @@ module MarshalTestLib end def test_fixnum - marshal_equal(-0x4000_0000) + #marshal_equal(-0x4000_0000) # not fixnum under 1.6... + marshal_equal(-0x3fff_ffff) marshal_equal(-1) marshal_equal(0) marshal_equal(1) @@ -253,7 +259,7 @@ module MarshalTestLib end def test_string_ivar - o1 = String.new + o1 = "" o1.instance_eval { @iv = 1 } marshal_equal(o1) {|o| o.instance_eval { @iv }} end @@ -281,12 +287,31 @@ module MarshalTestLib end MyStruct = Struct.new("MyStruct", :a, :b) + if RUBY_VERSION < "1.8.0" + # Struct#== is not defined in ruby/1.6 + class MyStruct + def ==(rhs) + return true if __id__ == rhs.__id__ + return false unless rhs.is_a?(::Struct) + return false if self.class != rhs.class + members.each do |member| + return false if self.__send__(member) != rhs.__send__(member) + end + return true + end + end + end class MySubStruct < MyStruct; def initialize(v, *args) super(*args); @v = v; end end def test_struct marshal_equal(MyStruct.new(1,2)) end def test_struct_subclass + if RUBY_VERSION < "1.8.0" + # Substruct instance cannot be dumped in ruby/1.6 + # ::Marshal.dump(MySubStruct.new(10, 1, 2)) #=> uninitialized struct + return false + end marshal_equal(MySubStruct.new(10,1,2)) end @@ -379,6 +404,7 @@ module MarshalTestLib def <=>(other); true; end end def test_range_cyclic + return unless CyclicRange.respond_to?(:allocate) # test for 1.8 o1 = CyclicRange.allocate o1.instance_eval { initialize(o1, o1) } o2 = marshaltest(o1) @@ -413,14 +439,14 @@ module MarshalTestLib end def test_extend_string - o = String.new + o = "" o.extend Mod1 marshal_equal(o) { |obj| obj.kind_of? Mod1 } - o = String.new + o = "" o.extend Mod1 o.extend Mod2 marshal_equal(o) {|obj| class << obj; ancestors end} - o = String.new + o = "" o.extend Module.new assert_raises(TypeError) { marshaltest(o) } end @@ -447,8 +473,23 @@ module MarshalTestLib end MyStruct2 = Struct.new(:a, :b) + if RUBY_VERSION < "1.8.0" + # Struct#== is not defined in ruby/1.6 + class MyStruct2 + def ==(rhs) + return true if __id__ == rhs.__id__ + return false unless rhs.is_a?(::Struct) + return false if self.class != rhs.class + members.each do |member| + return false if self.__send__(member) != rhs.__send__(member) + end + return true + end + end + end def test_struct_toplevel - marshal_equal(MyStruct2.new(1,2)) + o = MyStruct2.new(1,2) + marshal_equal(o) end end |