1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/soap/test_mapping.rb
(no author) 15b7d43988 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-22 13:20:28 +00:00

59 lines
1.2 KiB
Ruby

require 'test/unit'
require 'soap/mapping'
module SOAP
class TestMapping < Test::Unit::TestCase
def test_date
targets = [
["2002-12-31",
"2002-12-31Z"],
["2002-12-31+00:00",
"2002-12-31Z"],
["2002-12-31-00:00",
"2002-12-31Z"],
["-2002-12-31",
"-2002-12-31Z"],
["-2002-12-31+00:00",
"-2002-12-31Z"],
["-2002-12-31-00:00",
"-2002-12-31Z"],
]
targets.each do |str, expectec|
d = Date.parse(str)
assert_equal(d.class, convert(d).class)
assert_equal(d, convert(d))
end
end
def test_datetime
targets = [
["2002-12-31T23:59:59.00",
"2002-12-31T23:59:59Z"],
["2002-12-31T23:59:59+00:00",
"2002-12-31T23:59:59Z"],
["2002-12-31T23:59:59-00:00",
"2002-12-31T23:59:59Z"],
["-2002-12-31T23:59:59.00",
"-2002-12-31T23:59:59Z"],
["-2002-12-31T23:59:59+00:00",
"-2002-12-31T23:59:59Z"],
["-2002-12-31T23:59:59-00:00",
"-2002-12-31T23:59:59Z"],
]
targets.each do |str, expectec|
d = DateTime.parse(str)
assert_equal(d.class, convert(d).class)
assert_equal(d, convert(d))
end
end
def convert(obj)
SOAP::Mapping.soap2obj(SOAP::Mapping.obj2soap(obj))
end
end
end