* nih-dbus-tool/tests/test_interface.c (test_annotation): Add test
case for an empty symbol annotation
* nih-dbus-tool/interface.c (interface_annotation): Explicitly allow
the symbol to be empty
diff --git a/ChangeLog b/ChangeLog
index 1065beb..5cf6c87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-06-17 Scott James Remnant <scott@netsplit.com>
+ * nih-dbus-tool/tests/test_interface.c (test_annotation): Add test
+ case for an empty symbol annotation
+ * nih-dbus-tool/interface.c (interface_annotation): Explicitly allow
+ the symbol to be empty
+
* configure.ac: Bump version up to 0.3.0, I think the nih-dbus-tool
changes are enough to warrant it
diff --git a/nih-dbus-tool/interface.c b/nih-dbus-tool/interface.c
index 4572822..8df64bc 100644
--- a/nih-dbus-tool/interface.c
+++ b/nih-dbus-tool/interface.c
@@ -380,7 +380,7 @@
}
} else if (! strcmp (name, "com.netsplit.Nih.Symbol")) {
- if (symbol_valid (value)) {
+ if ((strlen (value) == 0) || symbol_valid (value)) {
if (interface->symbol)
nih_unref (interface->symbol, interface);
diff --git a/nih-dbus-tool/tests/test_interface.c b/nih-dbus-tool/tests/test_interface.c
index 93313e9..ebf2d17 100644
--- a/nih-dbus-tool/tests/test_interface.c
+++ b/nih-dbus-tool/tests/test_interface.c
@@ -863,6 +863,39 @@
}
+ /* Check that an annotation to request no symbol for the interface
+ * is handled.
+ */
+ TEST_FEATURE ("with empty symbol annotation");
+ TEST_ALLOC_FAIL {
+ TEST_ALLOC_SAFE {
+ interface = interface_new (NULL, "com.netsplit.Nih.Test");
+ }
+
+ ret = interface_annotation (interface,
+ "com.netsplit.Nih.Symbol",
+ "");
+
+ if (test_alloc_failed) {
+ TEST_LT (ret, 0);
+
+ err = nih_error_get ();
+ TEST_EQ (err->number, ENOMEM);
+ nih_free (err);
+
+ nih_free (interface);
+ continue;
+ }
+
+ TEST_EQ (ret, 0);
+
+ TEST_EQ_STR (interface->symbol, "");
+ TEST_ALLOC_PARENT (interface->symbol, interface);
+
+ nih_free (interface);
+ }
+
+
/* Check that an invalid value for the deprecated annotation results
* in an error being raised.
*/