From bc315949ed40734b23625e4d0ef3f71824658fc8 Mon Sep 17 00:00:00 2001 From: nahi Date: Mon, 23 May 2005 15:40:01 +0000 Subject: * 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 --- ChangeLog | 8 ++++++++ test/soap/calc/calc2.rb | 4 ++-- test/soap/calc/server2.rb | 4 ++-- test/soap/calc/test_calc2.rb | 6 +++--- test/wsdl/document/test_rpc.rb | 33 ++++++++++++++++++++++++--------- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5897625cc4..0b3122714a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue May 24 00:34:32 2005 NAKAMURA, Hiroshi + + * 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] + Mon May 23 16:24:05 2005 Hidetoshi NAGAI * ext/tcltklib/extconf.rb: Framework support on MacOS X Tiger. 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 -- cgit v1.2.3