gtk2-perl / suggesting adding automated testcases


As you may know, in the gtk2-perl effort lead by Goran, the
testcases are an important thing.

While coding the handling of perl strings to use with gtkenums
(e.g. passing 'toplevel' to the Gtk2::Window::new), I've put the
following code in "misc-examples/"; it runs a
series of significative tests, without user interaction, and die
when an unexpected error happens.

Why not using this? I don't suggest removing existing test cases
or tutorial examples that require user interaction, just adding
another "categories" of testcases, "automatic" ones.

Then, when we change potentially intrusive code, we'll just have
to run something of the like "make automatic-tests" and voila :).

print "Testing creation of a Gtk::Window with 'toplevel' as an arg.\n";
$w = new Gtk2::Window('toplevel');
$w->isa('Gtk2::Window') or die "FAILURE: Previous call should have created a Gtk::Window\n";

print "Testing creation of a Gtk::Window with 'topleel' as an arg (expecting failure).\n";
eval { $w = new Gtk2::Window('topleel') };
$@ =~ /^FATAL: invalid GtkWindowType value topleel/ or die "FAILURE: Previous call should throw an exception 

print "\nAll Ok.\n";

Guillaume Cottenceau -

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