Re: Comments on glib testing framework



On Fri, 2008-01-11 at 11:17 +0100, ext Tim Janik wrote:
> On Wed, 9 Jan 2008, Tommi Komulainen wrote:
> 
> > make -k test probably shouldn't abort gtester on first failing assertion

> i wouldn't know of a portable way to detect "make -k" invocations to make
> the test: rule behave differently. and, is there really a need for that,
> given that you could run test-report: instead?

Well, perhaps not. It would just be more familiar and not require extra
thinking (make all <-> make all -k vs. make test <-> make test-report)
Not a big deal.


> > glib/gtestutils.h references g_object_unref() which requires
> gobject.

> (i guess one could argue for g_test_queue_unref() to be moved to a gobject/
> header for "cleanliness", but then we'd have to find a proper place for it,
> and probably have documentation splits as well...)

Yes, minor detail, but if there'd be support for g_assert_cmpenum and
g_assert_cmpflags those would have to be in gobject as well.


> hm, it looks a bit cumbersome to use, since you always need to provide
> to correct enum type id as well:
>    g_assert_cmpenum (mode, ==, GTK_SIZE_GROUP_BOTH, GTK_TYPE_SIZE_GROUP_MODE);
> 
> judging from other gtk code errors, those type ids are easily gotten wrong
> if unchecked, and in your implementation, the type id is used very seldomly,
> i.e. only if the actual assertion fails...

I'd think it would be worth the added clarity in output, but can't argue
with that. Of course you'd be free to use whatever is convenient.


> also, g_assert_cmpint() will already provide a lot of information (in
> particular the stringified assertion macro arguments):
>    gint mode = GTK_SIZE_GROUP_HORIZONTAL;
>    g_assert_cmpint (mode, ==, GTK_SIZE_GROUP_BOTH);
> generates
>    ** ERROR:(testing.c:195):main: assertion failed (mode == GTK_SIZE_GROUP_BOTH): (1 == 3)
> 
> i guess you're mostly aiming for cases where both macro arguments are
> variables?

Well, no. Quickly, what size group mode is '1'? What widget state is 3?
What GtkWidgetFlags are set in 0x6? I was aiming to make things more
readable.


-- 
Tommi Komulainen                            <tommi komulainen nokia com>


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