From a1c416fbbd46d632376bd47d5dca908904e8cba8 Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Fri, 17 Jun 2011 19:40:48 +0000 Subject: [PATCH] THRIFT-1202 Malformed JSON for map 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 --- lib/c_glib/test/testthrifttestclient.cpp | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp index 15389a5b..795e47fd 100644 --- a/lib/c_glib/test/testthrifttestclient.cpp +++ b/lib/c_glib/test/testthrifttestclient.cpp @@ -113,6 +113,23 @@ class TestHandler : public ThriftTestIf { out = thing; } + void testStringMap(map &out, const map &thing) { + printf("[C -> C++] testStringMap({"); + map::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 &out, const set &thing) { printf("[C -> C++] testSet({"); set::const_iterator s_iter; @@ -405,6 +422,17 @@ test_thrift_client (void) 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); -- 2.17.1