On Fri, Mar 9, 2018 at 10:57 PM, Al Thomas <astav...@yahoo.co.uk> wrote:
Of course! I hope I understand now. assert_no_error is used to check
the error is unset. The assertion is from GLib and used with C.
So in C you have GError as an out argument and if the argument is null
then assert_no_error passes. That is the point of the argument.
Huh, I see what you mean now. But again, why does GLib bother with the
out argument? If it's not null the assert will trip and the program
will exit, if not value of the out param will always be null. Pretty
In Vala, however, the GError is hidden. It is only exposed inside the
catch block and so
will always be set. So I think I understand now. You know the error
always be set so it will always fail and then print the values of the
No no, the idea is that some call may throw an error but it shouldn't.
However if it does it is useful to know what the error is, to aid
For some background, Geary is using Julien's TestCase class for unit
At the moment, test cases must catch all exceptions manually since the
TestMethod delegate defined in that class doesn't allow them to throw
errors. This is pretty annoying to have to do manually for every method
that may throw an error, so I am modifying TestMethod to permit
throwing errors and are catching them in the test harness instead. Thus
it is useful if the test harness pints out the details of the
unexpected error, so we know what the unexpected error was.
Hence I was interested in assert_no_error() for it's printing of the
error details, not for it asserting that the error was null.
Thinking it through again, it looks like assert_no_error is broken in
I think assert_false is as well. Have you ever tried assert_false(
That should pass, but fails for me.
I haven't tried assert_false, because I ended up rolling my own version
of all of the GLib assert_* methods. I've basically given up on GLib's
test methods because they seem pretty useless to call from vala, and
don't let you provide a human readable string as additional context.
⊨ Michael Gratton, Percept Wrangler.
vala-list mailing list