[ nice-Bugs-1096734 ] assert doesn't print useful info. Lines wrong.

"SourceForge.net" <[email protected]> Fri, 25 Feb 2005 04:26:35 -0800
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #1096734, was opened at 2005-01-05 22:12
Message generated for change (Comment added) made by bonniot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1096734&group_id=12788

Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: mike.beckerle (mbeckerle)
>Assigned to: Daniel Bonniot (bonniot)
Summary: assert doesn't print useful info. Lines wrong.

Initial Comment:
Version 0.9.10

I am using lots of assertions and the unit testing system.

My assertions don't give enough information:

e.g., 

Test failed:
 nice.lang.AssertionFailed
Location: fun.nice method _test_reader line 202

1) The line number is fictitious. It's not at line 202 of 
any file of mine. 

2) The "assertion failed" message ought to repeat the 
text of the assertion so you can see what failed. This 
eliminates the desire to use the assert message text to 
redundantly restate the predicate. That is, you shouldn't 
write messages like:

assert (foo < 5): "foo not less than 5";

Instead if you write:

assert (foo < 5);

the system shoudl print

nice.lang.AssertionFailed "(foo < 5)"

and then give a line number in a real file.






----------------------------------------------------------------------

>Comment By: Daniel Bonniot (bonniot)
Date: 2005-02-25 13:26

Message:
Logged In: YES 
user_id=88952

I just fixed the niceunit framework, so that it prints
correct line numbers.Thanks for pointing this problem out.

Now that this is fixed, I'm not sure how useful it would be
for assert to include the text of the expression being
tested. Out of the context of the source code, it will often
not make much sense. Furthermore, this could encourage
people not to write a more meaningful string about the
reason why they think this assertion will succeed.

If you disagree, feel free to open a feature request for
that behavior. I close this report, as I estimate the main
bug is solved.

----------------------------------------------------------------------

Comment By: Arjan Boeijink (arjanb)
Date: 2005-01-05 23:24

Message:
Logged In: YES 
user_id=688815

1) Right, reporting of line numbers need improvement 
especially in nicec generated classes like 'fun' and 'dispatch'.

2) That's a good idea.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1096734&group_id=12788


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click