summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/Variant.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2010-03-18 18:37:28 +0000
committerGordon Sim <gsim@apache.org>2010-03-18 18:37:28 +0000
commitd0c0c11e83798904672f4bb88cd0fdcc93d4570b (patch)
tree3f218f6b3100c2ca8794b3ef8570e863f9178017 /qpid/cpp/src/tests/Variant.cpp
parent5e33292a317033a6b9db95010a6d198ee27bdfa5 (diff)
downloadqpid-python-d0c0c11e83798904672f4bb88cd0fdcc93d4570b.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@924939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/Variant.cpp')
-rw-r--r--qpid/cpp/src/tests/Variant.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/Variant.cpp b/qpid/cpp/src/tests/Variant.cpp
index c0bb9772c8..db9e419eab 100644
--- a/qpid/cpp/src/tests/Variant.cpp
+++ b/qpid/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