summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-14 15:14:02 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-14 15:14:02 +0000
commit9cba39a1a1b09f94a5d890e0ad6f4c74bb9f36bf (patch)
tree559f6780e94880fc3e7c37678fbe8b49ff0556d7 /test
parent0b841783b508c9bddb1c0117b1970fc7c350843b (diff)
* lib/soap/baseData.rb: Introduce SOAPType as the common ancestor of
SOAPBasetype and SOAPCompoundtype. * lib/soap/generator.rb, lib/soap/element.rb, lib/soap/encodingstyle/*: Encoding methods signature change. Pass SOAPGenerator as a parameter. * lib/soap/mapping/*, test/soap/marshal/test_marshal.rb: Refactoring for better marshalling/unmarshalling support. Now I think SOAP marshaller supports all kind of object graph which is supported by Ruby's original marshaller. Of course there could be bugs as always. Find it. :-) * lib/soap/rpc/standaloneServer.rb: Set severity threshould to INFO. DEBUG is too noisy. * lib/xsd/datatypes.rb: DateTime#of is obsoleted. Use DateTime#offset. * test/wsdl/emptycomplextype.wsdl, test/xsd/xmlschema.xml: Avoid useless warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_beginendblock.rb3
-rw-r--r--test/ruby/test_marshal.rb13
-rw-r--r--test/soap/marshal/test_marshal.rb172
-rw-r--r--test/wsdl/emptycomplextype.wsdl1
-rw-r--r--test/xsd/xmlschema.xml13
5 files changed, 178 insertions, 24 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index c7296a4e85..deacc782b7 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -39,8 +39,7 @@ STDERR.reopen(File.open(errout, "w"))
STDERR.sync = true
Dir.chdir(#{q(DIR)})
cmd = "\\"#{ruby}\\" \\"endblockwarn.rb\\""
-exec(cmd)
-exit!("must not reach here")
+system(cmd)
EOF
launcher.close
launcherpath = launcher.path
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index e4e4cc3c6a..ac804eb24c 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -252,6 +252,19 @@ module MarshalTestLib
marshal_equal(o) {|obj| class << obj; ancestors end}
end
+ def test_extend_string
+ o = String.new
+ o.extend Mod1
+ marshal_equal(o) { |obj| obj.kind_of? Mod1 }
+ o = String.new
+ o.extend Module.new
+ assert_raises(TypeError) { marshaltest(o) }
+ o = String.new
+ o.extend Mod1
+ o.extend Mod2
+ marshal_equal(o) {|obj| class << obj; ancestors end}
+ end
+
def test_anonymous
c = Class.new
assert_raises(TypeError) { marshaltest(c) }
diff --git a/test/soap/marshal/test_marshal.rb b/test/soap/marshal/test_marshal.rb
index 21776c5fd1..cfdab39ab2 100644
--- a/test/soap/marshal/test_marshal.rb
+++ b/test/soap/marshal/test_marshal.rb
@@ -7,6 +7,10 @@ module Marshal
module MarshalTestLib
+
+ module Mod1; end
+ module Mod2; end
+
def encode(o)
SOAPMarshal.dump(o)
end
@@ -23,19 +27,20 @@ module MarshalTestLib
o2
end
- def marshal_equal(o1)
+ def marshal_equal(o1, msg = nil)
+ msg = msg ? msg + "(#{ caller[0] })" : caller[0]
o2 = marshaltest(o1)
- assert_equal(o1.class, o2.class, caller[0])
+ assert_equal(o1.class, o2.class, msg)
iv1 = o1.instance_variables.sort
iv2 = o2.instance_variables.sort
assert_equal(iv1, iv2)
val1 = iv1.map {|var| o1.instance_eval {eval var}}
val2 = iv1.map {|var| o2.instance_eval {eval var}}
- assert_equal(val1, val2, caller[0])
+ assert_equal(val1, val2, msg)
if block_given?
- assert_equal(yield(o1), yield(o2), caller[0])
+ assert_equal(yield(o1), yield(o2), msg)
else
- assert_equal(o1, o2, caller[0])
+ assert_equal(o1, o2, msg)
end
end
@@ -50,6 +55,30 @@ module MarshalTestLib
marshal_equal(MyObject.new(2)) {|o| o.v}
end
+ def test_object_extend
+ o1 = Object.new
+ o1.extend(Mod1)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ o1.extend(Mod2)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ end
+
+ def test_object_subclass_extend
+ o1 = MyObject.new(2)
+ o1.extend(Mod1)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ o1.extend(Mod2)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ end
+
class MyArray < Array; def initialize(v, *args) super args; @v = v; end end
def test_array
marshal_equal([1,2,3])
@@ -59,6 +88,12 @@ module MarshalTestLib
marshal_equal(MyArray.new(0, 1,2,3))
end
+ def test_array_ivar
+ o1 = Array.new
+ o1.instance_eval { @iv = 1 }
+ marshal_equal(o1) {|o| o.instance_eval { @iv }}
+ end
+
class MyException < Exception; def initialize(v, *args) super(*args); @v = v; end; attr_reader :v; end
def test_exception
marshal_equal(Exception.new('foo')) {|o| o.message}
@@ -94,6 +129,36 @@ module MarshalTestLib
assert_raises(TypeError) { marshaltest(h) }
end
+ def test_hash_ivar
+ o1 = Hash.new
+ o1.instance_eval { @iv = 1 }
+ marshal_equal(o1) {|o| o.instance_eval { @iv }}
+ end
+
+ def test_hash_extend
+ o1 = Hash.new
+ o1.extend(Mod1)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ o1.extend(Mod2)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ end
+
+ def test_hash_subclass_extend
+ o1 = MyHash.new(2)
+ o1.extend(Mod1)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ o1.extend(Mod2)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ end
+
def test_bignum
marshal_equal(-0x4000_0000_0000_0001)
marshal_equal(-0x4000_0001)
@@ -122,6 +187,24 @@ module MarshalTestLib
marshal_equal(-0.0) {|o| 1.0/o}
end
+ def test_float_ivar
+ o1 = 1.23
+ o1.instance_eval { @iv = 1 }
+ marshal_equal(o1) {|o| o.instance_eval { @iv }}
+ end
+
+ def test_float_extend
+ o1 = 0.0/0.0
+ o1.extend(Mod1)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ o1.extend(Mod2)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ end
+
class MyRange < Range; def initialize(v, *args) super(*args); @v = v; end end
def test_range
marshal_equal(1..2)
@@ -129,19 +212,17 @@ module MarshalTestLib
end
def test_range_subclass
- STDERR.puts("test_range_subclass: known bug should be fixed.")
- return
marshal_equal(MyRange.new(4,5,8, false))
end
class MyRegexp < Regexp; def initialize(v, *args) super(*args); @v = v; end end
def test_regexp
marshal_equal(/a/)
+ marshal_equal(/A/i)
+ marshal_equal(/A/mx)
end
def test_regexp_subclass
- STDERR.puts("test_regexp_subclass: known bug should be fixed.")
- return
marshal_equal(MyRegexp.new(10, "a"))
end
@@ -150,10 +231,34 @@ module MarshalTestLib
marshal_equal("abc")
end
+ def test_string_ivar
+ o1 = String.new
+ o1.instance_eval { @iv = 1 }
+ marshal_equal(o1) {|o| o.instance_eval { @iv }}
+ end
+
def test_string_subclass
marshal_equal(MyString.new(10, "a"))
end
+ def test_string_subclass_cycle
+ str = MyString.new(10, "b")
+ str.instance_eval { @v = str }
+ marshal_equal(str) { |o|
+ assert_equal(o.__id__, o.instance_eval { @v }.__id__)
+ o.instance_eval { @v }
+ }
+ end
+
+ def test_string_subclass_extend
+ o = "abc"
+ o.extend(Mod1)
+ str = MyString.new(o, "c")
+ marshal_equal(str) { |o|
+ assert(o.instance_eval { @v }).kind_of?(Mod1)
+ }
+ end
+
MyStruct = Struct.new("MyStruct", :a, :b)
class MySubStruct < MyStruct; def initialize(v, *args) super(*args); @v = v; end end
def test_struct
@@ -164,6 +269,24 @@ module MarshalTestLib
marshal_equal(MySubStruct.new(10,1,2))
end
+ def test_struct_ivar
+ o1 = MyStruct.new
+ o1.instance_eval { @iv = 1 }
+ marshal_equal(o1) {|o| o.instance_eval { @iv }}
+ end
+
+ def test_struct_subclass_extend
+ o1 = MyStruct.new
+ o1.extend(Mod1)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ o1.extend(Mod2)
+ marshal_equal(o1) { |o|
+ (class << self; self; end).ancestors
+ }
+ end
+
def test_symbol
marshal_equal(:a)
marshal_equal(:a?)
@@ -201,16 +324,21 @@ module MarshalTestLib
def test_time
# once there was a bug caused by usec overflow. try a little harder.
10.times do
- marshal_equal(Time.now)
+ t = Time.now
+ marshal_equal(t, t.usec.to_s)
end
end
def test_time_subclass
- STDERR.puts("test_time_subclass: known bug should be fixed.")
- return
marshal_equal(MyTime.new(10))
end
+ def test_time_ivar
+ o1 = Time.now
+ o1.instance_eval { @iv = 1 }
+ marshal_equal(o1) {|o| o.instance_eval { @iv }}
+ end
+
def test_true
marshal_equal(true)
end
@@ -250,22 +378,30 @@ module MarshalTestLib
assert_raises(TypeError) { marshaltest(ENV) }
end
- module Mod1 end
- module Mod2 end
def test_extend
o = Object.new
+ o.extend Mod1
+ marshal_equal(o) { |obj| obj.kind_of? Mod1 }
+ o = Object.new
+ o.extend Mod1
+ o.extend Mod2
+ marshal_equal(o) {|obj| class << obj; ancestors end}
+ o = Object.new
o.extend Module.new
assert_raises(TypeError) { marshaltest(o) }
+ end
- STDERR.puts("test_range_subclass: known bug should be fixed.")
- return
- o = Object.new
+ def test_extend_string
+ o = String.new
o.extend Mod1
marshal_equal(o) { |obj| obj.kind_of? Mod1 }
- o = Object.new
+ o = String.new
o.extend Mod1
o.extend Mod2
marshal_equal(o) {|obj| class << obj; ancestors end}
+ o = String.new
+ o.extend Module.new
+ assert_raises(TypeError) { marshaltest(o) }
end
def test_anonymous
diff --git a/test/wsdl/emptycomplextype.wsdl b/test/wsdl/emptycomplextype.wsdl
index a4504c95ba..afd8dc239f 100644
--- a/test/wsdl/emptycomplextype.wsdl
+++ b/test/wsdl/emptycomplextype.wsdl
@@ -8,7 +8,6 @@
xmlns:i2="http://www.winfessor.com/SoapBoxWebService/ExceptionDataSet.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:i0="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd"
- xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://www.winfessor.com/SoapBoxWebService/SoapBoxWebService"
xmlns="http://schemas.xmlsoap.org/wsdl/">
diff --git a/test/xsd/xmlschema.xml b/test/xsd/xmlschema.xml
index f532e2934e..0e9914e64b 100644
--- a/test/xsd/xmlschema.xml
+++ b/test/xsd/xmlschema.xml
@@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
-<xs:schema xmlns:mstns="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd" id="MessageDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element msdata:IsDataSet="true" name="MessageDataSet">
+<xs:schema
+ xmlns:mstns="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd"
+ xmlns="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd"
+ attributeFormDefault="qualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd"
+ id="MessageDataSet"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="MessageDataSet">
<xs:complexType>
<xs:choice maxOccurs="unbounded" />
</xs:complexType>
</xs:element>
-</xs:schema> \ No newline at end of file
+</xs:schema>