summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests
diff options
context:
space:
mode:
authorJonathan Robie <jonathan@apache.org>2010-09-16 14:52:37 +0000
committerJonathan Robie <jonathan@apache.org>2010-09-16 14:52:37 +0000
commit6053fe2e1f8fa32db37d93e0b8456b53eca8a39c (patch)
tree3af6892f7e49cac15afdf21985fdee40aae1d17d /qpid/cpp/src/tests
parent8f2a0309176e62ef5d399243ebca2c6a6defc7d5 (diff)
downloadqpid-python-6053fe2e1f8fa32db37d93e0b8456b53eca8a39c.tar.gz
Fixes parsing problem with empty lists ('[]') in addresses, which previously raised an exception and leaked the memory associated with the AddressImpl.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@997771 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
-rw-r--r--qpid/cpp/src/tests/Address.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/Address.cpp b/qpid/cpp/src/tests/Address.cpp
index a0b87e25af..32d14bb4b8 100644
--- a/qpid/cpp/src/tests/Address.cpp
+++ b/qpid/cpp/src/tests/Address.cpp
@@ -87,6 +87,24 @@ QPID_AUTO_TEST_CASE(testParseOptionsWithList)
BOOST_CHECK_EQUAL((uint16_t) 101, address.getOptions()["x"].asInt64());
}
+QPID_AUTO_TEST_CASE(testParseOptionsWithEmptyList)
+{
+ Address address("my-topic; {a:[], x:101}");
+ BOOST_CHECK_EQUAL(std::string("my-topic"), address.getName());
+ Variant::List& list = address.getOptions()["a"].asList();
+ BOOST_CHECK_EQUAL(list.size(), 0);
+ BOOST_CHECK_EQUAL((uint16_t) 101, address.getOptions()["x"].asInt64());
+}
+
+QPID_AUTO_TEST_CASE(testParseOptionsWithEmptyMap)
+{
+ Address address("my-topic; {a:{}, x:101}");
+ BOOST_CHECK_EQUAL(std::string("my-topic"), address.getName());
+ Variant::Map& map = address.getOptions()["a"].asMap();
+ BOOST_CHECK_EQUAL(map.size(), 0);
+ BOOST_CHECK_EQUAL((uint16_t) 101, address.getOptions()["x"].asInt64());
+}
+
QPID_AUTO_TEST_CASE(testParseQuotedNameAndSubject)
{
Address address("'my topic with / in it'/'my subject with ; in it'");