ruby-changes:22887
From: tenderlove <ko1@a...>
Date: Wed, 7 Mar 2012 08:30:16 +0900 (JST)
Subject: [ruby-changes:22887] tenderlove:r34936 (trunk): * lib/xmlrpc/parser.rb: support i8 types. Thanks Stas Kelvich!
tenderlove 2012-03-07 08:30:03 +0900 (Wed, 07 Mar 2012) New Revision: 34936 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34936 Log: * lib/xmlrpc/parser.rb: support i8 types. Thanks Stas Kelvich! [ruby-core:29246] [Feature #3090] * test/xmlrpc/test_client.rb: supporting test Modified files: trunk/ChangeLog trunk/lib/xmlrpc/parser.rb trunk/test/xmlrpc/test_client.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 34935) +++ ChangeLog (revision 34936) @@ -1,3 +1,10 @@ +Wed Mar 7 08:28:00 2012 Aaron Patterson <aaron@t...> + + * 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@t...> * lib/xmlrpc/client.rb: assume servers that do not send a Content-Type Index: lib/xmlrpc/parser.rb =================================================================== --- lib/xmlrpc/parser.rb (revision 34935) +++ lib/xmlrpc/parser.rb (revision 34936) @@ -169,7 +169,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ case name when "string" @value = @data - when "i4", "int" + when "i4", "i8", "int" @value = Convert.int(@data) when "boolean" @value = Convert.boolean(@data) Index: test/xmlrpc/test_client.rb =================================================================== --- test/xmlrpc/test_client.rb (revision 34935) +++ test/xmlrpc/test_client.rb (revision 34936) @@ -233,6 +233,20 @@ 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)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/