summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-23 15:40:01 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-23 15:40:01 +0000
commitbc315949ed40734b23625e4d0ef3f71824658fc8 (patch)
treeafd76f48e18d1f0f118e0bb22b45b56dfa2ec381 /test
parent4e8ec8f2fab63ddc6f873747aa3fc48b943e5c54 (diff)
* test/soap/calc: method name 'set' was able to crash with a class Set.
[ruby-dev:26210] * test/wsdl/document/test_rpc.rb: dateTime comparison failed under TZ=right/Asia/Tokyo (with leap second.) [ruby-dev:26208] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/soap/calc/calc2.rb4
-rw-r--r--test/soap/calc/server2.rb4
-rw-r--r--test/soap/calc/test_calc2.rb6
-rw-r--r--test/wsdl/document/test_rpc.rb33
4 files changed, 31 insertions, 16 deletions
diff --git a/test/soap/calc/calc2.rb b/test/soap/calc/calc2.rb
index e9cf6bb..6949573 100644
--- a/test/soap/calc/calc2.rb
+++ b/test/soap/calc/calc2.rb
@@ -3,11 +3,11 @@ class CalcService2
@value = value
end
- def set(value)
+ def set_value(value)
@value = value
end
- def get
+ def get_value
@value
end
diff --git a/test/soap/calc/server2.rb b/test/soap/calc/server2.rb
index 1c9eec6..01c6d75 100644
--- a/test/soap/calc/server2.rb
+++ b/test/soap/calc/server2.rb
@@ -6,8 +6,8 @@ require 'calc2'
class CalcServer2 < SOAP::RPC::StandaloneServer
def on_init
servant = CalcService2.new
- add_method(servant, 'set', 'newValue')
- add_method(servant, 'get')
+ add_method(servant, 'set_value', 'newValue')
+ add_method(servant, 'get_value')
add_method_as(servant, '+', 'add', 'lhs')
add_method_as(servant, '-', 'sub', 'lhs')
add_method_as(servant, '*', 'multi', 'lhs')
diff --git a/test/soap/calc/test_calc2.rb b/test/soap/calc/test_calc2.rb
index 8d6180e..f334b29 100644
--- a/test/soap/calc/test_calc2.rb
+++ b/test/soap/calc/test_calc2.rb
@@ -20,8 +20,8 @@ class TestCalc2 < Test::Unit::TestCase
@endpoint = "http://localhost:#{Port}/"
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
@var.wiredump_dev = STDERR if $DEBUG
- @var.add_method('set', 'newValue')
- @var.add_method('get')
+ @var.add_method('set_value', 'newValue')
+ @var.add_method('get_value')
@var.add_method_as('+', 'add', 'rhs')
@var.add_method_as('-', 'sub', 'rhs')
@var.add_method_as('*', 'multi', 'rhs')
@@ -36,7 +36,7 @@ class TestCalc2 < Test::Unit::TestCase
end
def test_calc2
- assert_equal(1, @var.set(1))
+ assert_equal(1, @var.set_value(1))
assert_equal(3, @var + 2)
assert_equal(-1.2, @var - 2.2)
assert_equal(2.2, @var * 2.2)
diff --git a/test/wsdl/document/test_rpc.rb b/test/wsdl/document/test_rpc.rb
index 66b804a..5dac10d 100644
--- a/test/wsdl/document/test_rpc.rb
+++ b/test/wsdl/document/test_rpc.rb
@@ -105,15 +105,28 @@ class TestRPC < Test::Unit::TestCase
echo.xmlattr_attr_int = 5
ret = @client.echo(echo)
- timeformat = "%Y-%m-%dT%H:%M:%S.%s"
+ # struct#m_datetime in a response is a DateTime even though
+ # struct#m_datetime in a request is a Time.
assert_equal("mystring2", ret.struct1.m_string)
- assert_equal(now2.strftime(timeformat), ret.struct1.m_datetime.strftime(timeformat))
+ assert_equal(now2, date2time(ret.struct1.m_datetime))
assert_equal("mystring1", ret.struct_2.m_string)
- assert_equal(now1.strftime(timeformat), ret.struct_2.m_datetime.strftime(timeformat))
+ assert_equal(now1, date2time(ret.struct_2.m_datetime))
assert_equal("attr_string", ret.xmlattr_attr_string)
assert_equal(5, ret.xmlattr_attr_int)
end
+ def date2time(date)
+ if date.respond_to?(:to_time)
+ date.to_time
+ else
+ d = date.new_offset(0)
+ d.instance_eval {
+ Time.utc(year, mon, mday, hour, min, sec,
+ (sec_fraction * 86400000000).to_i)
+ }.getlocal
+ end
+ end
+
include ::SOAP
def test_naive
@client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/")
@@ -136,11 +149,11 @@ class TestRPC < Test::Unit::TestCase
ret = @client.echo(echo)
timeformat = "%Y-%m-%dT%H:%M:%S"
assert_equal('mystring2', ret.struct1.m_string)
- assert_equal('2005-03-17T19:47:32', ret.struct1.m_datetime.strftime(timeformat))
- #p ret.struct1.class
- #p ret.struct_2.class
+ assert_equal('2005-03-17T19:47:32',
+ ret.struct1.m_datetime.strftime(timeformat))
assert_equal("mystring1", ret.struct_2.m_string)
- assert_equal('2005-03-17T19:47:31', ret.struct_2.m_datetime.strftime(timeformat))
+ assert_equal('2005-03-17T19:47:31',
+ ret.struct_2.m_datetime.strftime(timeformat))
assert_equal('attr_string', ret.xmlattr_attr_string)
assert_equal(5, ret.xmlattr_attr_int)
@@ -149,9 +162,11 @@ class TestRPC < Test::Unit::TestCase
ret = @client.echo(echo)
timeformat = "%Y-%m-%dT%H:%M:%S"
assert_equal('mystring2', ret.struct1.m_string)
- assert_equal('2005-03-17T19:47:32', ret.struct1.m_datetime.strftime(timeformat))
+ assert_equal('2005-03-17T19:47:32',
+ ret.struct1.m_datetime.strftime(timeformat))
assert_equal("mystring1", ret.struct_2.m_string)
- assert_equal('2005-03-17T19:47:31', ret.struct_2.m_datetime.strftime(timeformat))
+ assert_equal('2005-03-17T19:47:31',
+ ret.struct_2.m_datetime.strftime(timeformat))
end
end