Re: [Vala] GLib.assert_no_error not working?



    > On Thursday, 8 March 2018, 00:14:12 GMT, Michael Gratton <mike vee net> wrote: 
GLib.assert_no_error doesn't seem to do anything that its API docs 
advertises for me - doesn't asset, doesn't pretty print the error 
message.

See the attached minimal test case, per the comments I'd expect it to 
abort on line 9, but it actually aborts on line 11. This is what I get:

Am I missing something here?

The assertion is in a catch block so err will be set. Whereas assert_no_erroris used to check err is unset 
(i.e. null). The line about 'produce a message that includesthe error message and code' seems like a 
copy/paste error in the documentation.
What you might want is assert_error, but the C docs for that advise 'If you want totest that err is set, but 
don't care what it's set to, just useg_assert (err != NULL)'
Regards,
Al
  


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