diff --git a/source/ddbus/conv.d b/source/ddbus/conv.d index d4a74cd..43e491a 100644 --- a/source/ddbus/conv.d +++ b/source/ddbus/conv.d @@ -372,21 +372,3 @@ unittest { readIter!(BitFlags!F)(&iter2).assertThrow!InvalidValueException(); } -unittest { - import dunit.toolkit; - import ddbus.thin; - - struct S1 { int a; double b; string s; } - struct S2 { Variant!int c; string d; S1 e; uint f; } - - Message msg = Message("org.example.wow", "/wut", "org.test.iface", "meth3"); - - enum testStruct = S2(variant(5), "blah", S1(-7, 63.5, "test"), 16); - msg.build(testStruct); - - DBusMessageIter iter; - dbus_message_iter_init(msg.msg, &iter); - - readIter!S2(&iter).assertEqual(testStruct); -} - diff --git a/source/ddbus/thin.d b/source/ddbus/thin.d index de60eba..7710502 100644 --- a/source/ddbus/thin.d +++ b/source/ddbus/thin.d @@ -570,6 +570,19 @@ struct Connection { } } +unittest { + import dunit.toolkit; + + struct S1 { private int a; double b; string s; } + struct S2 { Variant!int c; string d; S1 e; uint f; } + + Message msg = Message("org.example.wow", "/wut", "org.test.iface", "meth3"); + + enum testStruct = S2(variant(5), "blah", S1(-7, 63.5, "test"), 16); + msg.build(testStruct); + msg.read!S2().assertEqual(testStruct); +} + Connection connectToBus(DBusBusType bus = DBusBusType.DBUS_BUS_SESSION) { DBusConnection *conn = wrapErrors((err) { return dbus_bus_get(bus,err); }); return Connection(conn);