Re: gtk2-perl / suggesting adding automated testcases



Dermot Musgrove <dermot glade perl connectfree co uk> writes:

[...]

I guess that there are two sorts of tests that we want to run.

1) Those designed to visit _every_ corner of a feature - like testing
each and every enum in enums-as-strings.pl for a developer.

2) Those that test a Gtk2-Perl build - like testing that the enums 
generated by enums-as-strings.pl are available. This would only require
testing one or two enums and could be done as part of a more general 
widget test.

Yes. Only problem being the time it takes to do exhaustive tests
by hands - probably we should try to sort a sort of auto tests
generator if possible.
 

[...]

eval {} test of enums-as-strings.pl, Dermot?
The tests that you suggested in your previous email could be run in

[...]

3) I have changed Gtk2::Test so that you can specify $EXPECT_ERROR and a
check to apply to the error raised. In this case Gtk2::Test will compare
to $err (error message) rather than $ret (value returned by method). 

Obviously it would return $OK if the check is true but $err will still
contain the error and some explanations.

Then the tests would be 
  [$USE "Gtk2::Window"],
      ["new('toplevel')"],
      ["new('topleel')", $EXPECT_ERROR, 
          "=~ /FATAL: invalid GtkWindowType value topleel/"],

Since Gtk2::Test prepends some information to the error message, you
cannot expect the Gtk2 error to be at the start of the string.

Does this do what you need Guillaume?

Hum the third thing looks real nice!

But - well I tried it but it didn't work (latest CVS); I've added
the following at line 22:

        [$USE, "Gtk2::Window"],
            ["new('toplevel')"],
            ["new('topleel')", $EXPECT_ERROR,   "=~ /FATAL: invalid GtkWindowType value topleel/"],

Which gives:

(..)
ok 14
not ok 15
# Test 15 got: '__FAIL' (Gtk2/Test.pm at line 216 fail #3)
#    Expected: '__OK' (Unexpected error returned by Gtk2::Window->new('topleel') was 
'Gtk2::Window->new('topleel') FAILED: FATAL: invalid GtkWindowType value topleel, expecting: toplevel / 
GTK_WINDOW_TOPLEVEL, popup / GTK_WINDOW_POPUP at (eval 31) line 1.
#' which does NOT =~ /FATAL: invalid GtkWindowType value topleel/)


Also, Test.pm error reporting would be better if you could
include the original line (or <file.pl> line) in the error
because it won't be always easy to guess which line is th 15th,
and counting on screen would be boring :).


See you.

-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



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