From: SourceForge.net <no...@so...> - 2003-07-28 19:45:25
|
Bugs item #779111, was opened at 2003-07-28 12:35 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=779111&group_id=44253 Category: Debugger Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Running Unit Test in Non-Debug vs. Debug Mode Changes Bhvr. Initial Comment: DRJ: 20030724-2151 JDK: 1.4.1_02 Win2k Pro Consider the following code: public class Jones extends TestCase // implements WinsAgain { public void testStuff() { Thread cooper = new Thread() { public void run() { System.out.println("Compilers rock!"); } }; cooper.start(); while(cooper.isAlive()) { } System.out.println("Cooper is no longer running."); assertTrue(true); } } Clicking the "Test" button while not in debug mode produces the following output: -------------------------------------------------- Welcome to DrJava. Compilers rock! Cooper is no longer running. > --------------------------------------------------- Changing to the Test Output Tab: --------------------------------------------------- All tests completed successfully. --------------------------------------------------- Now, I click Reset. Now I click Debugger->Debug Mode I do nothing else (no brakepoints, nothing) I click Test: ------------------------------------------------- Welcome to DrJava. Compilers rock! > -------------------------------------------------- -------------------------------------------------- Testing in progress. Please wait... -------------------------------------------------- ... and testing never finshes... no exceptions are thrown. looking at the Threads tab of the debugger I see: --------------------------------------------------- JUnit Test Thread | RUNNING --------------------------------------------------- So it would seem that testing in debug vs non debug mode changes the result of the program, namely, does the thread cooper die? I don't think this is desired, I think this is a bug. If this *is* the desired result of executing in debug mode, it is non obvious that testing in debug mode has the potential of changing the result of a program in the mind of the user--it would seem to violate program correctness. And as a great Thread once told me, not preserving program correctness and meaning is a Bad Thing :). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=779111&group_id=44253 |