diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-06 23:30:03 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-06 23:30:03 +0000 |
commit | ce2f69862e019a570b6793b1a4753476a9cb72a6 (patch) | |
tree | 1a1977c7f41fdd0575079941c1f811b361174b7b | |
parent | 9e9264c8d55b63e1033ed1a415ca9280744cf446 (diff) | |
download | ruby-ce2f69862e019a570b6793b1a4753476a9cb72a6.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/xmlrpc/parser.rb | 10 | ||||
-rw-r--r-- | test/xmlrpc/test_client.rb | 14 |
3 files changed, 26 insertions, 5 deletions
@@ -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 diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb index eb3c9b3441..5db139e751 100644 --- a/lib/xmlrpc/parser.rb +++ b/lib/xmlrpc/parser.rb @@ -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) diff --git a/test/xmlrpc/test_client.rb b/test/xmlrpc/test_client.rb index d0e47b17d6..c3c3854d72 100644 --- a/test/xmlrpc/test_client.rb +++ b/test/xmlrpc/test_client.rb @@ -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)) |