diff options
author | Gordon Sim <gsim@apache.org> | 2010-03-18 18:37:28 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-03-18 18:37:28 +0000 |
commit | 53df223b3e2d08aed1bb70649c1f0269e0639f84 (patch) | |
tree | 3b6cb3d0b2a1ec005412d6ce4030fe1e738bf945 /cpp/src/tests/Variant.cpp | |
parent | 615cde45bd6415a6b562aeb6b2954c20c48aaed5 (diff) | |
download | qpid-python-53df223b3e2d08aed1bb70649c1f0269e0639f84.tar.gz |
QPID-2452: Fixed control over the encoding used when sending a string valued variant. The user is currently responsible for correctly setting any encoding (e.g. utf8). If none is specified it will be transfered as an amqp0-10 vbin. Fixed bug preventing correct assignment of encoding in variants.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@924939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/Variant.cpp')
-rw-r--r-- | cpp/src/tests/Variant.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cpp/src/tests/Variant.cpp b/cpp/src/tests/Variant.cpp index c0bb9772c8..db9e419eab 100644 --- a/cpp/src/tests/Variant.cpp +++ b/cpp/src/tests/Variant.cpp @@ -178,6 +178,21 @@ QPID_AUTO_TEST_CASE(testIsEqualTo) BOOST_CHECK_EQUAL(a, b); } +QPID_AUTO_TEST_CASE(testEncoding) +{ + Variant a("abc"); + a.setEncoding("utf8"); + Variant b = a; + Variant map = Variant::Map(); + map.asMap()["a"] = a; + map.asMap()["b"] = b; + BOOST_CHECK_EQUAL(a.getEncoding(), std::string("utf8")); + BOOST_CHECK_EQUAL(a.getEncoding(), b.getEncoding()); + BOOST_CHECK_EQUAL(a.getEncoding(), map.asMap()["a"].getEncoding()); + BOOST_CHECK_EQUAL(b.getEncoding(), map.asMap()["b"].getEncoding()); + BOOST_CHECK_EQUAL(map.asMap()["a"].getEncoding(), map.asMap()["b"].getEncoding()); +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests |