mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
94aa5943bb
commit
087ff5d6e7
5 changed files with 39 additions and 16 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Tue May 24 00:39:14 2005 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
||||||
|
|
||||||
|
* 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:23:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Mon May 23 16:23:06 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/extconf.rb: Framework support on MacOS X Tiger.
|
* ext/tk/extconf.rb: Framework support on MacOS X Tiger.
|
||||||
|
|
|
@ -3,11 +3,11 @@ class CalcService2
|
||||||
@value = value
|
@value = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def set(value)
|
def set_value(value)
|
||||||
@value = value
|
@value = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def get
|
def get_value
|
||||||
@value
|
@value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ require 'calc2'
|
||||||
class CalcServer2 < SOAP::RPC::StandaloneServer
|
class CalcServer2 < SOAP::RPC::StandaloneServer
|
||||||
def on_init
|
def on_init
|
||||||
servant = CalcService2.new
|
servant = CalcService2.new
|
||||||
add_method(servant, 'set', 'newValue')
|
add_method(servant, 'set_value', 'newValue')
|
||||||
add_method(servant, 'get')
|
add_method(servant, 'get_value')
|
||||||
add_method_as(servant, '+', 'add', 'lhs')
|
add_method_as(servant, '+', 'add', 'lhs')
|
||||||
add_method_as(servant, '-', 'sub', 'lhs')
|
add_method_as(servant, '-', 'sub', 'lhs')
|
||||||
add_method_as(servant, '*', 'multi', 'lhs')
|
add_method_as(servant, '*', 'multi', 'lhs')
|
||||||
|
|
|
@ -20,8 +20,8 @@ class TestCalc2 < Test::Unit::TestCase
|
||||||
@endpoint = "http://localhost:#{Port}/"
|
@endpoint = "http://localhost:#{Port}/"
|
||||||
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
|
@var = SOAP::RPC::Driver.new(@endpoint, 'http://tempuri.org/calcService')
|
||||||
@var.wiredump_dev = STDERR if $DEBUG
|
@var.wiredump_dev = STDERR if $DEBUG
|
||||||
@var.add_method('set', 'newValue')
|
@var.add_method('set_value', 'newValue')
|
||||||
@var.add_method('get')
|
@var.add_method('get_value')
|
||||||
@var.add_method_as('+', 'add', 'rhs')
|
@var.add_method_as('+', 'add', 'rhs')
|
||||||
@var.add_method_as('-', 'sub', 'rhs')
|
@var.add_method_as('-', 'sub', 'rhs')
|
||||||
@var.add_method_as('*', 'multi', 'rhs')
|
@var.add_method_as('*', 'multi', 'rhs')
|
||||||
|
@ -36,7 +36,7 @@ class TestCalc2 < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_calc2
|
def test_calc2
|
||||||
assert_equal(1, @var.set(1))
|
assert_equal(1, @var.set_value(1))
|
||||||
assert_equal(3, @var + 2)
|
assert_equal(3, @var + 2)
|
||||||
assert_equal(-1.2, @var - 2.2)
|
assert_equal(-1.2, @var - 2.2)
|
||||||
assert_equal(2.2, @var * 2.2)
|
assert_equal(2.2, @var * 2.2)
|
||||||
|
|
|
@ -105,15 +105,28 @@ class TestRPC < Test::Unit::TestCase
|
||||||
echo.xmlattr_attr_int = 5
|
echo.xmlattr_attr_int = 5
|
||||||
ret = @client.echo(echo)
|
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("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("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("attr_string", ret.xmlattr_attr_string)
|
||||||
assert_equal(5, ret.xmlattr_attr_int)
|
assert_equal(5, ret.xmlattr_attr_int)
|
||||||
end
|
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
|
include ::SOAP
|
||||||
def test_naive
|
def test_naive
|
||||||
@client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/")
|
@client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/")
|
||||||
|
@ -136,11 +149,11 @@ class TestRPC < Test::Unit::TestCase
|
||||||
ret = @client.echo(echo)
|
ret = @client.echo(echo)
|
||||||
timeformat = "%Y-%m-%dT%H:%M:%S"
|
timeformat = "%Y-%m-%dT%H:%M:%S"
|
||||||
assert_equal('mystring2', ret.struct1.m_string)
|
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',
|
||||||
#p ret.struct1.class
|
ret.struct1.m_datetime.strftime(timeformat))
|
||||||
#p ret.struct_2.class
|
|
||||||
assert_equal("mystring1", ret.struct_2.m_string)
|
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('attr_string', ret.xmlattr_attr_string)
|
||||||
assert_equal(5, ret.xmlattr_attr_int)
|
assert_equal(5, ret.xmlattr_attr_int)
|
||||||
|
|
||||||
|
@ -149,9 +162,11 @@ class TestRPC < Test::Unit::TestCase
|
||||||
ret = @client.echo(echo)
|
ret = @client.echo(echo)
|
||||||
timeformat = "%Y-%m-%dT%H:%M:%S"
|
timeformat = "%Y-%m-%dT%H:%M:%S"
|
||||||
assert_equal('mystring2', ret.struct1.m_string)
|
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("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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue