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

"SourceForge.net" <[email protected]> Sat, 02 Apr 2005 03:54:41 -0800
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #1096734, was opened at 2005-01-05 13:12
Message generated for change (Comment added) made by nobody
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: Nobody/Anonymous (nobody)
Date: 2005-04-02 03:54

Message:
Logged In: NO 

Automatic assertion message is now generated for assertion
without one (2). The text of the assertion is not directly
repeated (it is curently hard to achieve).
Exact location of the failed assertion is included in the
message. It might be very useful if stack trace is not
available (for a number of reasons) or not produced by the
"printStackTraceWithSourceInfo".
Implementation is currently available in the CVS HEAD.

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

Comment By: Daniel Bonniot (bonniot)
Date: 2005-02-25 04: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 14: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