mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-03-23 22:42:20 +01:00
96 lines
8.4 KiB
Diff
96 lines
8.4 KiB
Diff
Patch-Source: https://github.com/rakshasa/rtorrent/commit/350d03ca04fedc2153927b7bf26d43030e23d962
|
|
---
|
|
From 350d03ca04fedc2153927b7bf26d43030e23d962 Mon Sep 17 00:00:00 2001
|
|
From: kannibalox <kannibalox@gmail.com>
|
|
Date: Sat, 28 Dec 2024 11:24:04 -0500
|
|
Subject: [PATCH] Update XMLRPC unit tests to include <data> for arrays
|
|
|
|
---
|
|
test/rpc/xmlrpc_test.cc | 2 +-
|
|
test/rpc/xmlrpc_test_data.txt | 29 +++++++++++++++--------------
|
|
2 files changed, 16 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/test/rpc/xmlrpc_test.cc b/test/rpc/xmlrpc_test.cc
|
|
index 51120a11..7ca22657 100644
|
|
--- a/test/rpc/xmlrpc_test.cc
|
|
+++ b/test/rpc/xmlrpc_test.cc
|
|
@@ -69,7 +69,7 @@ XmlrpcTest::test_invalid_utf8() {
|
|
// valid UTF-8, but doesn't check strings, and Object strings are
|
|
// just a series of bytes so it reflects just fine.
|
|
std::string input = "<?xml version=\"1.0\"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><string>\xc3\x28</string></value></param></params></methodCall>";
|
|
- std::string expected = "<?xml version=\"1.0\"?><methodResponse><params><param><value><array><value><string>\xc3\x28</string></value></array></value></param></params></methodResponse>";
|
|
+ std::string expected = "<?xml version=\"1.0\"?><methodResponse><params><param><value><array><data><value><string>\xc3\x28</string></value></data></array></value></param></params></methodResponse>";
|
|
std::string output;
|
|
m_xmlrpc.process(input.c_str(), input.size(), [&output](const char* c, uint32_t l){ output.append(c, l); return true;});
|
|
CPPUNIT_ASSERT_EQUAL(expected, output);
|
|
diff --git a/test/rpc/xmlrpc_test_data.txt b/test/rpc/xmlrpc_test_data.txt
|
|
index c7adb105..bab15b23 100644
|
|
--- a/test/rpc/xmlrpc_test_data.txt
|
|
+++ b/test/rpc/xmlrpc_test_data.txt
|
|
@@ -1,50 +1,51 @@
|
|
# Basic call
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array/></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data/></array></value></param></params></methodResponse>
|
|
|
|
# Basic call without params
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array/></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data/></array></value></param></params></methodResponse>
|
|
|
|
# UTF-8 string
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><string>чао</string></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><string>чао</string></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><string>чао</string></value></data></array></value></param></params></methodResponse>
|
|
|
|
# emoji string
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><string>😊</string></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><string>😊</string></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><string>😊</string></value></data></array></value></param></params></methodResponse>
|
|
|
|
# base64 data (which gets returned as a string)
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><base64>Zm9vYmFy</base64></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><string>foobar</string></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><string>foobar</string></value></data></array></value></param></params></methodResponse>
|
|
|
|
# i8 ints
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><i8>41</i8></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><i8>41</i8></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><i8>41</i8></value></data></array></value></param></params></methodResponse>
|
|
|
|
# i8 ints
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><i8>2247483647</i8></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><i8>2247483647</i8></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><i8>2247483647</i8></value></data></array></value></param></params></methodResponse>
|
|
|
|
# negative i8 ints
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><i8>-2347483647</i8></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><i8>-2347483647</i8></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><i8>-2347483647</i8></value></data></array></value></param></params></methodResponse>
|
|
|
|
-# Empty array
|
|
+# Simple array
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><array><data><value><i8>2247483647</i8></value></data></array></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><array><value><i8>2247483647</i8></value></array></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><array><data><value><i8>2247483647</i8></value></data></array></value></data></array></value></param></params></methodResponse>
|
|
|
|
-# Simple array
|
|
+# Empty array
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><array><data></data></array></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><array/></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><array><data/></array></value></data></array></value></param></params></methodResponse>
|
|
|
|
# Empty struct
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><struct></struct></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><struct/></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><struct/></value></data></array></value></param></params></methodResponse>
|
|
|
|
# Simple struct
|
|
+
|
|
<?xml version="1.0"?><methodCall><methodName>xmlrpc_reflect</methodName><params><param><value><string></string></value></param><param><value><struct><member><name>lowerBound</name><value><i8>18</i8></value></member><member><name>upperBound</name><value><i8>139</i8></value></member></struct></value></param></params></methodCall>
|
|
-<?xml version="1.0"?><methodResponse><params><param><value><array><value><struct><member><name>lowerBound</name><value><i8>18</i8></value></member><member><name>upperBound</name><value><i8>139</i8></value></member></struct></value></array></value></param></params></methodResponse>
|
|
+<?xml version="1.0"?><methodResponse><params><param><value><array><data><value><struct><member><name>lowerBound</name><value><i8>18</i8></value></member><member><name>upperBound</name><value><i8>139</i8></value></member></struct></value></data></array></value></param></params></methodResponse>
|
|
|
|
# Invalid - missing method
|
|
<?xml version="1.0"?><methodCall><methodName>no_such_method</methodName><params><param><value><i8>41</i8></value></param></params></methodCall>
|