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
commit087ff5d6e715094d7c320c7d1d5aee32188e7b11 (patch)
tree79c8e7b489d83bddfda89ad47b564c8251fb5427 /test
parent94aa5943bb09d52580041e77d66b93d2d11b763d (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/trunk@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 e9cf6bbca7..69495730e7 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 1c9eec68e8..01c6d75289 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 8d6180e99e..f334b29bdb 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 66b804a0f9..5dac10d580 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