summaryrefslogtreecommitdiff
path: root/test/xmlrpc
diff options
context:
space:
mode:
authormneumann <mneumann@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-16 01:11:49 +0000
committermneumann <mneumann@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-16 01:11:49 +0000
commit8b38f8c03e28f12c4c92a47a903558b55f350c9d (patch)
tree773c5aecefde9fe6e6aa8b8ee1d77a08062435e8 /test/xmlrpc
parent0cf2581ec1ced929beaa04d154faaf8e41d0afeb (diff)
* applied patch by MoonWolf <moonwolf@moonwolf.com> to allow parsing
datetime.iso8601 (e.g. 20041105T01:15:23Z). * added test case git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc')
-rw-r--r--test/xmlrpc/data/datetime_iso8601.xml8
-rw-r--r--test/xmlrpc/test_parser.rb30
2 files changed, 27 insertions, 11 deletions
diff --git a/test/xmlrpc/data/datetime_iso8601.xml b/test/xmlrpc/data/datetime_iso8601.xml
new file mode 100644
index 0000000..43d8da6
--- /dev/null
+++ b/test/xmlrpc/data/datetime_iso8601.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<methodResponse>
+ <params>
+ <param>
+ <value><dateTime.iso8601>20041105T01:15:23Z</dateTime.iso8601></value>
+ </param>
+ </params>
+</methodResponse>
diff --git a/test/xmlrpc/test_parser.rb b/test/xmlrpc/test_parser.rb
index 3e55cdb..3665b6e 100644
--- a/test/xmlrpc/test_parser.rb
+++ b/test/xmlrpc/test_parser.rb
@@ -1,25 +1,29 @@
$LOAD_PATH.unshift '../../lib'
require 'test/unit'
+require 'xmlrpc/datetime'
require "xmlrpc/parser"
module GenericParserTest
def setup
- @xml1 = File.readlines("data/xml1.xml").to_s
- @expected1 = File.readlines("data/xml1.expected").to_s.chomp
+ @xml1 = File.read("data/xml1.xml")
+ @expected1 = File.read("data/xml1.expected").chomp
- @xml2 = File.readlines("data/bug_covert.xml").to_s
- @expected2 = File.readlines("data/bug_covert.expected").to_s.chomp
+ @xml2 = File.read("data/bug_covert.xml")
+ @expected2 = File.read("data/bug_covert.expected").chomp
- @xml3 = File.readlines("data/bug_bool.xml").to_s
- @expected3 = File.readlines("data/bug_bool.expected").to_s.chomp
+ @xml3 = File.read("data/bug_bool.xml")
+ @expected3 = File.read("data/bug_bool.expected").chomp
- @xml4 = File.readlines("data/value.xml").to_s
- @expected4 = File.readlines("data/value.expected").to_s.chomp
+ @xml4 = File.read("data/value.xml")
+ @expected4 = File.read("data/value.expected").chomp
- @cdata_xml = File.readlines("data/bug_cdata.xml").to_s.chomp
- @cdata_expected = File.readlines("data/bug_cdata.expected").to_s.chomp
+ @cdata_xml = File.read("data/bug_cdata.xml").chomp
+ @cdata_expected = File.read("data/bug_cdata.expected").chomp
- @fault_doc = File.readlines("data/fault.xml").to_s
+ @datetime_xml = File.read("data/datetime_iso8601.xml")
+ @datetime_expected = XMLRPC::DateTime.new(2004, 11, 5, 1, 15, 23)
+
+ @fault_doc = File.read("data/fault.xml").to_s
end
# test parseMethodResponse --------------------------------------------------
@@ -40,6 +44,10 @@ module GenericParserTest
assert_equal(@cdata_expected, @p.parseMethodResponse(@cdata_xml).inspect)
end
+ def test_dateTime
+ assert_equal(@datetime_expected, @p.parseMethodResponse(@datetime_xml)[1])
+ end
+
# test parseMethodCall ------------------------------------------------------
def test_parseMethodCall