Changeset 1169
- Timestamp:
- 05/19/08 03:07:14 (4 months ago)
- Files:
-
- trunk/descent.unittest/flute/.settings/descent.core.prefs (modified) (2 diffs)
- trunk/descent.unittest/flute/src/cn/kuehne/flectioned.d (modified) (12 diffs)
- trunk/descent.unittest/flute/src/org/dsource/descent/flute/flute.d (modified) (6 diffs)
- trunk/descent.unittest/flute/src/org/dsource/descent/flute/io.d (modified) (2 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/flute/FluteApplicationInstance.java (modified) (4 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/flute/RunningOneTest.java (modified) (2 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/launcher/UnittestLaunchConfiguration.java (modified) (1 diff)
- trunk/descent.unittest/src/descent/internal/unittest/model/TestRunSession.java (modified) (2 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/ui/JUnitMessages.java (modified) (3 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/ui/JUnitMessages.properties (modified) (3 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/ui/RerunAction.java (deleted)
- trunk/descent.unittest/src/descent/internal/unittest/ui/TestRunnerViewPart.java (modified) (16 diffs)
- trunk/descent.unittest/src/descent/internal/unittest/ui/TestViewer.java (modified) (2 diffs)
- trunk/descent.unittest/testdata/src/compile.bat (modified) (1 diff)
- trunk/descent.unittest/testdata/src/sample/module1.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/descent.unittest/flute/.settings/descent.core.prefs
r1106 r1169 1 #S un Apr 13 00:24:15PDT 20081 #Sat May 17 20:27:32 PDT 2008 2 2 descent.core.compiler.allowDeprecated=disabled 3 3 descent.core.compiler.debugIdentifiers= … … 9 9 descent.core.compiler.taskPriorities=NORMAL,HIGH,LOW,HIGH,LOW,NORMAL 10 10 descent.core.compiler.taskTags=TODO,FIXME,PERHAPS,WTF,NEXTVERSION,TANGO 11 descent.core.compiler.versionIdentifiers=DigitalMars, Windows, Win32, X86, LittleEndian, D_InlineAsm, D_InlineAsm_X86, all, FluteUnittests11 descent.core.compiler.versionIdentifiers=DigitalMars, Windows, Win32, X86, LittleEndian, D_InlineAsm, D_InlineAsm_X86, all, Tango 12 12 descent.core.compiler.versionLevel=0 13 13 descent.core.formatter.alignment_for_array_literals=16 trunk/descent.unittest/flute/src/cn/kuehne/flectioned.d
r1156 r1169 91 91 92 92 // import hell (-version=Tango isn't reliable) 93 const bool inTango = false; 94 const bool inPhobos = true; 93 version(Tango) 94 { 95 const bool inTango = true; 96 const bool inPhobos = false; 97 } 98 else 99 { 100 const bool inTango = false; 101 const bool inPhobos = true; 102 } 95 103 96 104 static if(inTango){ … … 102 110 import tango.core.Exception : IllegalArgumentException; 103 111 import tango.stdc.string : memmove, memcpy, memcmp, strcmp; 104 import tango.stdc.stringz : ptr2array = from Utf8z;112 import tango.stdc.stringz : ptr2array = fromStringz; 105 113 import tango.stdc.stdio : sscanf, printf; 106 import tango.text.convert.Integer : size2array = to Utf8;114 import tango.text.convert.Integer : size2array = toString; 107 115 import tango.core.Array : find, rfind; 108 116 import tango.text.Util : delimit; … … 110 118 private alias tango.stdc.errno.errno getErrno; 111 119 private alias tango.stdc.errno.errno setErrno; 112 import tango.core.Exception : TracedExceptionInfo, setTraceHandler;113 120 114 121 private uint toUint(char[] s){ … … 121 128 122 129 private char[] getString(Object o){ 123 return o.to Utf8();130 return o.toString(); 124 131 } 125 132 }else static if(inPhobos){ … … 442 449 } 443 450 444 static if(inTango){ 445 /// toString wrapper for Tango 446 override char[] toUtf8() 447 out(s){ 448 assert(s.length > 0); 449 }body{ 450 return toString(); 451 } 452 }else static if(!inPhobos){ 453 static assert(0, "neither object.Object.toUtf8 nor object.Object.toString found"); 454 } 455 456 string toString() 451 override string toString() 457 452 out(s){ 458 453 assert(s.length > 0); … … 929 924 } 930 925 } 931 }932 933 string toUtf8(){934 return toString();935 926 } 936 927 … … 1067 1058 1068 1059 1069 static if(inTango){1060 /+ static if(inTango){ 1070 1061 /** 1071 1062 * Exception containing stack trace information is provided by Tango, … … 1073 1064 * ... thus the opApply-trick 1074 1065 */ 1075 class TracedException : tango.core.Exception.TracedException{1066 class TracedException : Exception{ 1076 1067 /// 1077 1068 Trace[] trace; … … 1102 1093 opApply(dg); 1103 1094 } 1104 1105 ///1106 static TracedExceptionInfo tangoTraceHandler(void* ptr = null){1107 return new FlectionedTrace(ptr);1108 }1109 1095 1110 1096 /// … … 1117 1103 } 1118 1104 1119 private static class FlectionedTrace : TracedExceptionInfo{1105 private static class FlectionedTrace { 1120 1106 this(void* ptr = null ){ 1121 1107 if(ptr){ … … 1166 1152 } 1167 1153 } 1168 }else static if(inPhobos){ 1154 }else static if(inPhobos){ +/ 1169 1155 /** 1170 1156 * Exception containing stack trace information. … … 1350 1336 } 1351 1337 1352 }else{1338 /+ }else{ 1353 1339 static assert(0, "neither Phobos nor Tango"); 1354 } 1340 } +/ 1355 1341 1356 1342 private void print_traced_exception(Exception e) trunk/descent.unittest/flute/src/org/dsource/descent/flute/flute.d
r1164 r1169 340 340 341 341 /// A Flectioned marker indicating a unittest 342 private c onst char[] UNITTEST_MARKER = ".__unittest";342 private char[] UNITTEST_MARKER = ".__unittest"; 343 343 344 344 /// A marker indicating a named test 345 private c onst char[] NAMED_TEST_MARKER = ".__setTestName!(__testName_";345 private char[] NAMED_TEST_MARKER = ".__setTestName!(__testName_"; 346 346 347 347 /// A string containing version information, printed at the start of the application 348 private c onst char[] VERSION_STRING = "flute 0.1";348 private char[] VERSION_STRING = "flute 0.1"; 349 349 350 350 /** … … 352 352 * "on" or "off" 353 353 */ 354 private c onst stringSTACKTRACE_ATTR = "stacktrace";354 private char[] STACKTRACE_ATTR = "stacktrace"; 355 355 356 356 /* … … 484 484 char[] toHex(size_t val) 485 485 { 486 constint percision = (void*).sizeof * 2;486 int percision = (void*).sizeof * 2; 487 487 488 488 version(inPhobos) … … 856 856 assert(false); 857 857 } 858 return null; 858 859 } 859 860 … … 902 903 error++; 903 904 break; 905 default: 906 assert(false); 904 907 } 905 908 } … … 1025 1028 goto LnextCommand; 1026 1029 } 1030 1031 assert(false); 1027 1032 } 1028 1033 trunk/descent.unittest/flute/src/org/dsource/descent/flute/io.d
r1164 r1169 12 12 version(Tango) 13 13 { 14 14 version = inTango; 15 16 static if(!is(typeof(string))) 17 private alias char[] string; 15 18 } 16 19 else … … 158 161 exit(EXIT_FAILURE); 159 162 } 160 u int port =atoi(*portStr);163 ushort port = cast(ushort) atoi(*portStr); 161 164 162 165 serv = new TcpSocket(AddressFamily.INET); trunk/descent.unittest/src/descent/internal/unittest/flute/FluteApplicationInstance.java
r1162 r1169 32 32 static final String AWAITING_INPUT = "(flute)"; //$NON-NLS-1$ 33 33 private static final String LOCALHOST = "127.0.0.1"; //$NON-NLS-1$ 34 private static final long TIMEOUT = 10000; 34 35 35 36 private SocketConnection fConn; 36 37 37 private long fTimeout = 10000;38 38 private final Object fWaitLock = new Object(); 39 39 private volatile boolean fWaitLockUsed; … … 55 55 // connection 56 56 this.fPort = port; 57 }58 59 /**60 * Sets the timeout for commands. Particularly important when running61 * tests that could take a while.62 *63 * @param timeout the timeout, in milliseconds64 */65 public void setTimeout(long timeout)66 {67 fTimeout = timeout;68 57 } 69 58 … … 77 66 public boolean init() throws IOException 78 67 { 79 assert(fState instanceof StartingUp);80 assert(null == fConn);68 if(null != fConn || !(fState instanceof StartingUp)) 69 throw new IllegalStateException(); 81 70 82 71 beforeWaitStateReturn(); 83 72 84 // Make the connection (interpretation will begin automatically)73 // Wait for the connection to be established... with a timeout! 85 74 fConn = new SocketConnection(fPort); 86 waitStateReturn();87 boolean retVal = ((StartingUp) fState).hasCorrectVersion;88 setState(fWaitingState);89 return retVal;75 waitStateReturn(TIMEOUT); 76 boolean retVal = ((StartingUp) fState).hasCorrectVersion; 77 setState(fWaitingState); 78 return retVal; 90 79 } 91 80 … … 142 131 143 132 private void waitStateReturn() { 144 try { 145 synchronized (fWaitLock) { 146 if (!fWaitLockUsed) { 147 fWaitLock.wait(fTimeout); 148 } 149 } 150 } catch (InterruptedException e) { 151 e.printStackTrace(); 152 } 133 waitStateReturn(0); 134 } 135 136 private void waitStateReturn(long timeout) 137 { 138 try { 139 synchronized (fWaitLock) { 140 if (!fWaitLockUsed) { 141 fWaitLock.wait(timeout); 142 } 143 } 144 } catch (InterruptedException e) { 145 e.printStackTrace(); 146 } 153 147 } 154 148 trunk/descent.unittest/src/descent/internal/unittest/flute/RunningOneTest.java
r1115 r1169 44 44 private StringBuffer message; 45 45 private List<StackTraceElement> stackTrace; 46 private String internalError; 46 47 47 48 RunningOneTest(FluteApplicationInstance cli) … … 179 180 } 180 181 181 // If we get here, it's probably invalid text. Don't throw an 182 // exception because it might be a network error of some sort. 182 // If we get here, it's probably invalid text. There's been an internal 183 // error (this may desynchronize a lot of other stuff, but in that case 184 // there's bigger stuff to worry about 185 internalError = text; 186 cli.notifyStateReturn(); 183 187 } 184 188 185 189 FluteTestResult getResult() 186 190 { 191 if(internalError != null) 192 { 193 return FluteTestResult.error( 194 String.format(JUnitMessages.RunningOneTest_internal_error_with_message, 195 internalError), 196 "", //$NON-NLS-1$ 197 NO_STACK_TRACE); 198 } 199 187 200 if(resultType == null) 188 { 201 { 189 202 return FluteTestResult.error( 190 203 JUnitMessages.RunningOneTest_internal_error, trunk/descent.unittest/src/descent/internal/unittest/launcher/UnittestLaunchConfiguration.java
r1164 r1169 44 44 public class UnittestLaunchConfiguration extends 45 45 AbstractDescentLaunchConfigurationDelegate 46 { 47 /** 48 * The file to load as the list of tests to prioritize (maybe I should 49 * rethink how this is done -- no need for a whole file if we're using IPC). 50 */ 51 // RETHINK 52 public static final String FAILURES_FILENAME_ATTR= DescentUnittestPlugin.PLUGIN_ID+".FAILURENAMES"; //$NON-NLS-1$ 53 46 { 54 47 /** 55 48 * The file to create next to the fluted executable to use to find the port. trunk/descent.unittest/src/descent/internal/unittest/model/TestRunSession.java
r1164 r1169 206 206 */ 207 207 public boolean isKeptAlive() { 208 return f TestRunnerClient.isRunning() && ILaunchManager.DEBUG_MODE.equals(getLaunch().getLaunchMode());208 return false; 209 209 } 210 210 … … 241 241 addFailures(failures, children[i]); 242 242 } 243 }244 245 /**246 * @param testId247 * @param launchMode248 * @return <code>false</code> iff the rerun could not be started249 * @throws CoreException250 */251 public boolean rerunTest(String testId, String launchMode)252 throws CoreException253 {254 // TODO reruns, keeeping in mind the testId could refer to a255 // TestSuiteElement instead of just a TestcaseElement256 257 /*TestElement testElement = fIdToTest.get(testId);258 259 if(null == testElement)260 return false;261 262 TestCaseElement testCaseElement = (TestCaseElement) testElement;263 ITestSpecification test = testCaseElement.getTestSpecification();264 265 if (isKeptAlive())266 {267 Status status= ((TestCaseElement) getTestElement(testId)).getStatus();268 if (status == Status.ERROR) {269 fErrorCount--;270 } else if (status == Status.FAILURE) {271 fFailureCount--;272 }273 fTestRunnerClient.rerunTest(test);274 return true;275 276 }277 else if (getLaunch() != null)278 {279 // run the selected test using the previous launch configuration280 ILaunchConfiguration launchConfiguration= getLaunch().getLaunchConfiguration();281 if (launchConfiguration != null) {282 283 String name= className;284 if (testName != null)285 name+= "."+testName; //$NON-NLS-1$286 String configName= Messages.format(JUnitMessages.TestRunnerViewPart_configName, name);287 ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName);288 // fix for bug: 64838 unittest view run single test does not use correct class [JUnit]289 tmp.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, className);290 // reset the container291 tmp.setAttribute(JUnitBaseLaunchConfiguration.LAUNCH_CONTAINER_ATTR, ""); //$NON-NLS-1$292 if (testName != null) {293 tmp.setAttribute(JUnitBaseLaunchConfiguration.TESTNAME_ATTR, testName);294 // String args= "-rerun "+testId;295 // tmp.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);296 }297 tmp.launch(launchMode, null);298 return true;299 }300 } */301 302 return false;303 243 } 304 244 trunk/descent.unittest/src/descent/internal/unittest/ui/JUnitMessages.java
r1164 r1169 37 37 public static String OpenEditorAction_error_dialog_title; 38 38 public static String OpenEditorAction_message_cannotopen; 39 public static String RerunAction_label_debug;40 public static String RerunAction_label_run;41 39 public static String RunningOneTest_internal_error; 40 public static String RunningOneTest_internal_error_with_message; 42 41 public static String ScrollLockAction_action_label; 43 42 public static String ScrollLockAction_action_tooltip; … … 47 46 public static String ShowPreviousFailureAction_tooltip; 48 47 public static String TestRunnerViewPart_activate_on_failure_only; 49 public static String TestRunnerViewPart_cannotrerun_title;50 public static String TestRunnerViewPart_cannotrerurn_message;51 48 public static String TestRunnerViewPart_clear_history_label; 52 public static String TestRunnerViewPart_configName;53 public static String TestRunnerViewPart_error_cannotrerun;54 49 public static String TestRunnerViewPart_hierarchical_layout; 55 50 public static String TestRunnerViewPart_history; … … 65 60 public static String TestRunnerViewPart_rerunaction_label; 66 61 public static String TestRunnerViewPart_rerunaction_tooltip; 67 public static String TestRunnerViewPart_rerunFailedFirstLaunchConfigName;68 public static String TestRunnerViewPart_rerunfailuresaction_label;69 public static String TestRunnerViewPart_rerunfailuresaction_tooltip;70 62 public static String TestRunnerViewPart_select_test_run; 71 63 public static String TestRunnerViewPart_show_failures_only; trunk/descent.unittest/src/descent/internal/unittest/ui/JUnitMessages.properties
r1164 r1169 39 39 TestRunnerViewPart_rerunaction_tooltip=Rerun Test 40 40 TestRunnerViewPart_hierarchical_layout=Show Tests in &Hierarchy 41 TestRunnerViewPart_rerunfailuresaction_label=Rerun Test - Failures First42 TestRunnerViewPart_rerunfailuresaction_tooltip=Rerun Test - Failures First43 TestRunnerViewPart_rerunFailedFirstLaunchConfigName={0} (Failed Tests first)44 TestRunnerViewPart_error_cannotrerun=Could not rerun test45 41 TestRunnerViewPart_message_terminated=Terminated 46 TestRunnerViewPart_cannotrerun_title=Rerun Test47 TestRunnerViewPart_cannotrerurn_message=To rerun tests they must be launched under the debugger\nand \'Keep JUnit running\' must be set in the launch configuration.48 42 TestRunnerViewPart_clear_history_label=&Clear Terminated 49 43 TestRunnerViewPart_label_failure=Failure Trace … … 52 46 TestRunnerViewPart_message_stopped= Stopped 53 47 TestRunnerViewPart_message_stopping=Stopping... 54 TestRunnerViewPart_configName=Rerun {0}55 48 TestRunnerViewPart_layout_menu=Layout 56 49 TestRunnerViewPart_Launching=Launching {0}... … … 102 95 ExpandAllAction_text=Expand All 103 96 ExpandAllAction_tooltip=Expand All Nodes 104 RerunAction_label_run=&Run105 RerunAction_label_debug=&Debug106 97 RunningOneTest_internal_error=Internal error running test 98 RunningOneTest_internal_error_with_message=Internal error: %s 107 99 DUnittestFinder_task_name=Finding unit tests trunk/descent.unittest/src/descent/internal/unittest/ui/TestRunnerViewPart.java
r1115 r1169 14 14 package descent.internal.unittest.ui; 15 15 16 import java.io.BufferedWriter;17 import java.io.File;18 import java.io.FileWriter;19 import java.io.IOException;20 16 import java.text.DateFormat; 21 import java.text.MessageFormat;22 17 import java.text.NumberFormat; 23 18 import java.util.ArrayList; … … 26 21 import java.util.List; 27 22 28 import org.eclipse.core.runtime.CoreException;29 23 import org.eclipse.core.runtime.IProgressMonitor; 30 24 import org.eclipse.core.runtime.IStatus; … … 59 53 import org.eclipse.jface.action.MenuManager; 60 54 import org.eclipse.jface.action.Separator; 61 import org.eclipse.jface.dialogs.ErrorDialog;62 55 import org.eclipse.jface.dialogs.MessageDialog; 63 56 import org.eclipse.jface.preference.IPreferenceStore; … … 85 78 import org.eclipse.debug.core.ILaunch; 86 79 import org.eclipse.debug.core.ILaunchConfiguration; 87 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;88 80 89 81 import org.eclipse.debug.ui.DebugUITools; … … 100 92 import descent.internal.unittest.DescentUnittestPlugin; 101 93 import descent.internal.unittest.Messages; 102 import descent.internal.unittest.launcher.UnittestLaunchConfiguration;103 94 import descent.internal.unittest.model.ITestRunSessionListener; 104 95 import descent.internal.unittest.model.ITestSessionListener; 105 96 import descent.internal.unittest.model.TestCaseElement; 106 97 import descent.internal.unittest.model.TestElement; 107 import descent.internal.unittest.model.TestRoot;108 98 import descent.internal.unittest.model.TestRunSession; 109 import descent.internal.unittest.model.TestSuiteElement;110 99 import descent.unittest.ITestResult; 111 100 import descent.unittest.ITestResult.ResultType; … … 168 157 169 158 private Action fRerunLastTestAction; 170 private Action fRerunLastFailedFirstAction;171 159 172 160 private Action fFailuresOnlyFilterAction; … … 417 405 return; 418 406 fStopAction.setEnabled(lastLaunchIsKeptAlive()); 419 updateRerunFailedFirstAction();420 407 processChangesInUI(); 421 408 if (hasErrorsOrFailures()) { … … 587 574 public void run(){ 588 575 rerunTestRun(); 589 }590 }591 592 private class RerunLastFailedFirstAction extends Action {593 public RerunLastFailedFirstAction() {594 setText(JUnitMessages.TestRunnerViewPart_rerunfailuresaction_label);595 setToolTipText(JUnitMessages.TestRunnerViewPart_rerunfailuresaction_tooltip);596 DescentUnittestPlugin.setLocalImageDescriptors(this, "relaunchf.gif"); //$NON-NLS-1$597 setEnabled(false);598 }599 600 public void run(){601 rerunTestFailedFirst();602 576 } 603 577 } … … 862 836 } 863 837 if (fTestRunSession != null && fTestRunSession.getLaunch().getLaunchConfiguration() != null) { 864 ILaunchConfiguration configuration= prepareLaunchConfigForRelaunch(fTestRunSession.getLaunch().getLaunchConfiguration());838 ILaunchConfiguration configuration= fTestRunSession.getLaunch().getLaunchConfiguration(); 865 839 DebugUITools.launch(configuration, fTestRunSession.getLaunch().getLaunchMode()); 866 }867 }868 869 private ILaunchConfiguration prepareLaunchConfigForRelaunch(ILaunchConfiguration configuration) {870 try {871 String attribute= configuration.getAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, ""); //$NON-NLS-1$872 if (attribute.length() != 0) {873 String configName= Messages.format(JUnitMessages.TestRunnerViewPart_configName, configuration.getName());874 ILaunchConfigurationWorkingCopy tmp= configuration.copy(configName);875 tmp.setAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, ""); //$NON-NLS-1$876 return tmp;877 }878 } catch (CoreException e) {879 // fall through880 }881 return configuration;882 }883 884 public void rerunTestFailedFirst() {885 if (lastLaunchIsKeptAlive()) {886 // prompt for terminating the existing run887 if (MessageDialog.openQuestion(getSite().getShell(), JUnitMessages.TestRunnerViewPart_terminate_title, JUnitMessages.TestRunnerViewPart_terminate_message)) {888 if (fTestRunSession != null)889 fTestRunSession.stopTestRun();890 }891 }892 if (fTestRunSession.getLaunch() != null && fTestRunSession.getLaunch().getLaunchConfiguration() != null) {893 ILaunchConfiguration launchConfiguration= fTestRunSession.getLaunch().getLaunchConfiguration();894 if (launchConfiguration != null) {895 try {896 String oldName= launchConfiguration.getName();897 String oldFailuresFilename= launchConfiguration.getAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, (String) null);898 String configName;899 if (oldFailuresFilename != null) {900 configName= oldName;901 } else {902 configName= Messages.format(JUnitMessages.TestRunnerViewPart_rerunFailedFirstLaunchConfigName, oldName);903 }904 ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName);905 tmp.setAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, createFailureNamesFile());906 tmp.launch(fTestRunSession.getLaunch().getLaunchMode(), null);907 return;908 } catch (CoreException e) {909 ErrorDialog.openError(getSite().getShell(),910 JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus()911 );912 }913 }914 MessageDialog.openInformation(getSite().getShell(),915 JUnitMessages.TestRunnerViewPart_cannotrerun_title,916 JUnitMessages.TestRunnerViewPart_cannotrerurn_message917 );918 }919 }920 921 private String createFailureNamesFile() throws CoreException {922 try {923 File file= File.createTempFile("testFailures", ".txt"); //$NON-NLS-1$ //$NON-NLS-2$924 file.deleteOnExit();925 TestElement[] failures= fTestRunSession.getAllFailedTestElements();926 BufferedWriter bw= null;927 try {928 bw= new BufferedWriter(new FileWriter(file));929 for (int i= 0; i < failures.length; i++) {930 TestElement testElement= failures[i];931 bw.write(testElement.getName());932 bw.newLine();933 }934 } finally {935 if (bw != null) {936 bw.close();937 }938 }939 return file.getAbsolutePath();940 } catch (IOException e) {941 throw new CoreException(new Status(IStatus.ERROR, DescentUnittestPlugin.PLUGIN_ID, IStatus.ERROR, "", e)); //$NON-NLS-1$942 840 } 943 841 } … … 985 883 resetViewIcon(); 986 884 fStopAction.setEnabled(false); 987 updateRerunFailedFirstAction();988 885 } 989 886 }); … … 1070 967 1071 968 fStopAction.setEnabled(false); 1072 fRerunLastFailedFirstAction.setEnabled(false);1073 969 fRerunLastTestAction.setEnabled(false); 1074 970 … … 1084 980 registerInfoMessage(fTestRunSession.getTestRunName()); 1085 981 1086 updateRerunFailedFirstAction();1087 982 fRerunLastTestAction.setEnabled(true); 1088 983 … … 1098 993 } 1099 994 } 1100 }1101 1102 private void updateRerunFailedFirstAction() {1103 fRerunLastFailedFirstAction.setEnabled(hasErrorsOrFailures());1104 995 } 1105 996 … … 1362 1253 1363 1254 fRerunLastTestAction= new RerunLastAction(); 1364 fRerunLastFailedFirstAction= new RerunLastFailedFirstAction();1365 1255 1366 1256 fFailuresOnlyFilterAction= new FailuresOnlyFilterAction(); … … 1383 1273 toolBar.add(new Separator()); 1384 1274 toolBar.add(fRerunLastTestAction); 1385 toolBar.add(fRerunLastFailedFirstAction);1386 1275 toolBar.add(fStopAction); 1387 1276 toolBar.add(fViewHistory.createHistoryDropDownAction()); … … 1521 1410 public boolean isCreated() { 1522 1411 return fCounterPanel != null; 1523 }1524 1525 public void rerunTest(String testId, String launchMode) {1526 DebugUITools.saveAndBuildBeforeLaunch();1527 try {1528 boolean couldLaunch= fTestRunSession.rerunTest(testId, launchMode);1529 if (! couldLaunch) {1530 MessageDialog.openInformation(getSite().getShell(),1531 JUnitMessages.TestRunnerViewPart_cannotrerun_title,1532 JUnitMessages.TestRunnerViewPart_cannotrerurn_message);1533 } else if (fTestRunSession.isKeptAlive()) {1534 TestCaseElement testCaseElement= (TestCaseElement) fTestRunSession.getTestElement(testId);1535 testCaseElement.setStatus(TestElement.Status.RUNNING);1536 fTestViewer.registerViewerUpdate(testCaseElement);1537 postSyncProcessChanges();1538 }1539 1540 } catch (CoreException e) {1541 ErrorDialog.openError(getSite().getShell(),1542 JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus()1543 );1544 }1545 1412 } 1546 1413 trunk/descent.unittest/src/descent/internal/unittest/ui/TestViewer.java
r1052 r1169 215 215 manager.add(new OpenModuleAction(fTestRunnerPart, testElement.getId())); 216 216 manager.add(new Separator()); 217 if (!fTestRunnerPart.lastLaunchIsKeptAlive()) {218 manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.RUN_MODE));219 manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.DEBUG_MODE));220 }221 217 } else { 222 218 TestCaseElement testCaseElement= (TestCaseElement) testElement; … … 224 220 testCaseElement.getTestSpecification().getDeclaration())); 225 221 manager.add(new Separator()); 226 if (fTestRunnerPart.lastLaunchIsKeptAlive()) {227 manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.RUN_MODE));228 229 } else {230 manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.RUN_MODE));231 manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.DEBUG_MODE));232 }233 222 } 234 223 if (fLayoutMode == TestRunnerViewPart.LAYOUT_HIERARCHICAL) { trunk/descent.unittest/testdata/src/compile.bat
r1162 r1169 1 dmd -g - unittest -of..\bin\test sample\module1.d sample\foo\module3.d sample\foo\bar\module2.d ..\..\flute\src\cn\kuehne\flectioned.d ..\..\flute\src\org\dsource\descent\flute\flute.d ..\..\flute\src\org\dsource\descent\flute\io.d -IC:\dmd\src\phobos C:\d\dmd\lib\WS2_32.lib1 dmd -g -w -unittest -of..\bin\test sample\module1.d sample\foo\module3.d sample\foo\bar\module2.d ..\..\flute\src\cn\kuehne\flectioned.d ..\..\flute\src\org\dsource\descent\flute\flute.d ..\..\flute\src\org\dsource\descent\flute\io.d -IC:\dmd\src\phobos C:\d\dmd\lib\WS2_32.lib trunk/descent.unittest/testdata/src/sample/module1.d
r1162 r1169 1 1 module sample.module1; 2 3 import std.socket : SocketException;4 import std.thread : Thread;5 2 6 3 class ArgumentException : Exception … … 31 28 32 29 // To test stack tracing 33 throw new SocketException("YA RLY!", 69);30 throw new Exception("YA RLY!"); 34 31 } 35 32 … … 75 72 76 73 77 throw new ArgumentException("NO WAI!");74 throw new Exception("NO WAI!"); 78 75 } 79 76
