THRIFT-1202 Malformed JSON for map<string,type> services parameters
fix broken build => add missing testcase for testStringMap introduced with THRIFT-1202
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1137004 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp
index 15389a5..795e47f 100644
--- a/lib/c_glib/test/testthrifttestclient.cpp
+++ b/lib/c_glib/test/testthrifttestclient.cpp
@@ -113,6 +113,23 @@
out = thing;
}
+ void testStringMap(map<std::string, std::string> &out, const map<std::string, std::string> &thing) {
+ printf("[C -> C++] testStringMap({");
+ map<std::string, std::string>::const_iterator m_iter;
+ bool first = true;
+ for (m_iter = thing.begin(); m_iter != thing.end(); ++m_iter) {
+ if (first) {
+ first = false;
+ } else {
+ printf(", ");
+ }
+ printf("\"%s\" => \"%s\"", (m_iter->first).c_str(), (m_iter->second).c_str());
+ }
+ printf("})\n");
+ out = thing;
+ }
+
+
void testSet(set<int32_t> &out, const set<int32_t> &thing) {
printf("[C -> C++] testSet({");
set<int32_t>::const_iterator s_iter;
@@ -405,6 +422,17 @@
g_hash_table_destroy (map_out);
g_hash_table_destroy (map_in);
+ map_out = g_hash_table_new (NULL, NULL);
+ map_in = g_hash_table_new (NULL, NULL);
+ g_hash_table_insert (map_out, g_strdup ("a"), g_strdup ("123"));
+ g_hash_table_insert (map_out, g_strdup ("a b"), g_strdup ("with spaces "));
+ g_hash_table_insert (map_out, g_strdup ("same"), g_strdup ("same"));
+ g_hash_table_insert (map_out, g_strdup ("0"), g_strdup ("numeric key"));
+ assert (t_test_thrift_test_client_test_string_map (iface, &map_in, map_out, &error) == TRUE);
+ assert (error == NULL);
+ g_hash_table_destroy (map_out);
+ g_hash_table_destroy (map_in);
+
set_out = g_hash_table_new (NULL, NULL);
set_in = g_hash_table_new (NULL, NULL);
g_hash_table_insert (set_out, &i32, &i32);