qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1141910 - in /qpid/trunk/qpid/cpp/src: qpid/messaging/AddressParser.cpp tests/Address.cpp
Date Fri, 01 Jul 2011 12:00:56 GMT
Author: gsim
Date: Fri Jul  1 12:00:56 2011
New Revision: 1141910

URL: http://svn.apache.org/viewvc?rev=1141910&view=rev
Log:
QPID-3330: Corrected handling of empty strings (using patch from Anthony Foglia) and added
test case

Modified:
    qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp
    qpid/trunk/qpid/cpp/src/tests/Address.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp?rev=1141910&r1=1141909&r2=1141910&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp Fri Jul  1 12:00:56 2011
@@ -151,7 +151,7 @@ bool AddressParser::readValueIfExists(Va
 bool AddressParser::readString(std::string& value, char delimiter)
 {
     if (readChar(delimiter)) {
-        std::string::size_type start = current++;
+        std::string::size_type start = current;
         while (!eos()) {
             if (input.at(current) == delimiter) {
                 if (current > start) {

Modified: qpid/trunk/qpid/cpp/src/tests/Address.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Address.cpp?rev=1141910&r1=1141909&r2=1141910&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/Address.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/Address.cpp Fri Jul  1 12:00:56 2011
@@ -119,6 +119,17 @@ QPID_AUTO_TEST_CASE(testParseQuotedNameA
     BOOST_CHECK_EQUAL(std::string("my subject with ; in it"), address.getSubject());
 }
 
+QPID_AUTO_TEST_CASE(testParseOptionsWithEmptyStringAsValue)
+{
+    Address address("my-topic; {a:'', x:101}");
+    BOOST_CHECK_EQUAL(std::string("my-topic"), address.getName());
+    Variant a = address.getOptions()["a"];
+    BOOST_CHECK_EQUAL(VAR_STRING, a.getType());
+    std::string aVal = a;
+    BOOST_CHECK(aVal.size() == 0);
+    BOOST_CHECK_EQUAL((uint16_t) 101, address.getOptions()["x"].asInt64());
+}
+
 QPID_AUTO_TEST_SUITE_END()
 
 }}



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message