зеркало из https://github.com/github/ruby.git
* lib/xmlrpc/parser.rb: support i8 types. Thanks Stas Kelvich!
[ruby-core:29246] [Feature #3090] * test/xmlrpc/test_client.rb: supporting test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9e9264c8d5
Коммит
ce2f69862e
|
@ -1,3 +1,10 @@
|
|||
Wed Mar 7 08:28:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* lib/xmlrpc/parser.rb: support i8 types. Thanks Stas Kelvich!
|
||||
[ruby-core:29246] [Feature #3090]
|
||||
|
||||
* test/xmlrpc/test_client.rb: supporting test
|
||||
|
||||
Wed Mar 7 07:43:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* lib/xmlrpc/client.rb: assume servers that do not send a Content-Type
|
||||
|
|
|
@ -169,7 +169,7 @@ module XMLRPC
|
|||
private
|
||||
|
||||
#
|
||||
# remove all whitespaces but in the tags i4, int, boolean....
|
||||
# remove all whitespaces but in the tags i4, i8, int, boolean....
|
||||
# and all comments
|
||||
#
|
||||
def removeWhitespacesAndComments(node)
|
||||
|
@ -179,7 +179,7 @@ module XMLRPC
|
|||
case _nodeType(nd)
|
||||
when :TEXT
|
||||
# TODO: add nil?
|
||||
unless %w(i4 int boolean string double dateTime.iso8601 base64).include? node.nodeName
|
||||
unless %w(i4 i8 int boolean string double dateTime.iso8601 base64).include? node.nodeName
|
||||
|
||||
if node.nodeName == "value"
|
||||
if not node.childNodes.to_a.detect {|n| _nodeType(n) == :ELEMENT}.nil?
|
||||
|
@ -253,7 +253,7 @@ module XMLRPC
|
|||
def integer(node)
|
||||
#TODO: check string for float because to_i returnsa
|
||||
# 0 when wrong string
|
||||
nodeMustBe(node, %w(i4 int))
|
||||
nodeMustBe(node, %w(i4 i8 int))
|
||||
hasOnlyOneChild(node)
|
||||
|
||||
Convert.int(text(node.firstChild))
|
||||
|
@ -415,7 +415,7 @@ module XMLRPC
|
|||
text_zero_one(node)
|
||||
when :ELEMENT
|
||||
case child.nodeName
|
||||
when "i4", "int" then integer(child)
|
||||
when "i4", "i8", "int" then integer(child)
|
||||
when "boolean" then boolean(child)
|
||||
when "string" then string(child)
|
||||
when "double" then double(child)
|
||||
|
@ -525,7 +525,7 @@ module XMLRPC
|
|||
case name
|
||||
when "string"
|
||||
@value = @data
|
||||
when "i4", "int"
|
||||
when "i4", "i8", "int"
|
||||
@value = Convert.int(@data)
|
||||
when "boolean"
|
||||
@value = Convert.boolean(@data)
|
||||
|
|
|
@ -233,6 +233,20 @@ module XMLRPC
|
|||
assert_equal expected, resp
|
||||
end
|
||||
|
||||
def test_i8_tag
|
||||
fh = read('blog.xml').gsub(/string/, 'i8')
|
||||
|
||||
responses = {
|
||||
'/foo' => [ Fake::Response.new(fh) ]
|
||||
}
|
||||
|
||||
client = fake_client(responses).new2 'http://example.org/foo'
|
||||
|
||||
resp = client.call('wp.getUsersBlogs', 'tlo', 'omg')
|
||||
|
||||
assert_equal 1, resp.first['blogid']
|
||||
end
|
||||
|
||||
private
|
||||
def read filename
|
||||
File.read File.expand_path(File.join(__FILE__, '..', 'data', filename))
|
||||
|
|
Загрузка…
Ссылка в новой задаче