[daemon-fix] fixed querying about name information
[platform/upstream/dbus.git] / dbus / dbus-marshal-validate-util.c
index 6915c05..d52cb6d 100644 (file)
@@ -1,4 +1,4 @@
-/* -*- mode: C; c-file-style: "gnu" -*- */
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /* dbus-marshal-validate-util.c Would be in dbus-marshal-validate.c, but only used by tests/bus
  *
  * Copyright (C) 2005 Red Hat, Inc.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
 
 #include <config.h>
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
 #include "dbus-internals.h"
 #include "dbus-marshal-validate.h"
 #include "dbus-marshal-recursive.h"
@@ -68,7 +71,7 @@ static const ValidityTest signature_tests[] = {
   { "i", DBUS_VALID },
   { "ai", DBUS_VALID },
   { "(i)", DBUS_VALID },
-  { "q", DBUS_INVALID_UNKNOWN_TYPECODE },
+  { "w", DBUS_INVALID_UNKNOWN_TYPECODE },
   { "a", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
   { "aaaaaa", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
   { "ii(ii)a", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
@@ -89,7 +92,14 @@ static const ValidityTest signature_tests[] = {
   { "(())", DBUS_INVALID_STRUCT_HAS_NO_FIELDS },
   { "a()", DBUS_INVALID_STRUCT_HAS_NO_FIELDS },
   { "i()", DBUS_INVALID_STRUCT_HAS_NO_FIELDS },
-  { "()i", DBUS_INVALID_STRUCT_HAS_NO_FIELDS }
+  { "()i", DBUS_INVALID_STRUCT_HAS_NO_FIELDS },
+  { "(a)", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
+  { "a{ia}", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
+  { "a{}", DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS },
+  { "a{aii}", DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE },
+  /* { "a{i}", DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD }, */
+  /* { "{is}", DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY }, */
+  /* { "a{isi}", DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS }, */
 };
 
 dbus_bool_t
@@ -169,9 +179,9 @@ _dbus_marshal_validate_test (void)
     ":abce.freedesktop.blah"
   };
   const char *invalid_unique_names[] = {
-    ":-",
+    //":-",
     ":!",
-    ":0-10",
+    //":0-10",
     ":blah.",
     ":blah.",
     ":blah..org",
@@ -217,7 +227,8 @@ _dbus_marshal_validate_test (void)
     "not a valid signature",
     "123",
     ".",
-    "("
+    "(",
+    "a{(ii)i}" /* https://bugs.freedesktop.org/show_bug.cgi?id=17803 */
   };
 
   /* Signature with reason */
@@ -572,4 +583,6 @@ _dbus_marshal_validate_test (void)
   return TRUE;
 }
 
-#endif /* DBUS_BUILD_TESTS */
+#endif /* !DOXYGEN_SHOULD_SKIP_THIS */
+
+#endif /* DBUS_ENABLE_EMBEDDED_TESTS */