Re: Gtk+ unit tests (brainstorming)



Hi,

On Wed, 2006-10-25 at 17:52 +0200, Tim Janik wrote:
> - GLib based test programs should never produce a "CRITICAL **:" or
>    "WARNING **:" message and succeed.

Sometimes it is useful to check that a critical message was indeed
shown, and then move on. GStreamer installs a log handler that aborts if
criticals are shown unexpectedly, but also has the ability to test that
GStreamer fails appropriately.

For example, here is a test from gstreamer/tests/check/gst/gstobject.c:

/* g_object_new on abstract GstObject should fail */
GST_START_TEST (test_fail_abstract_new)
{
  GstObject *object;

  ASSERT_CRITICAL (object = g_object_new (gst_object_get_type (),
NULL));
  fail_unless (object == NULL, "Created an instance of abstract
GstObject");
}

I could 44 uses of this pattern in GStreamer core's test suite, based on
libcheck (but with a wrapper).

Regards,

Andy.
-- 
http://wingolog.org/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]