Skip to content

Commit ac217c8

Browse files
committed
Bug 573108: Add test harness for VT100Emulator
This contains basic tests so far, as bugs are fixed other tests can be added here, leading to easier development of escape sequences. Change-Id: Iadd0b24d400f72927c446d61386f19cfd8bd05a0
1 parent fa1639a commit ac217c8

File tree

1 file changed

+13
-0
lines changed
  • terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/provisional/api

1 file changed

+13
-0
lines changed

terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ public final class Logger {
5555
private static PrintStream logStream;
5656
private static StackWalker walker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
5757

58+
private static boolean underTest = false;
59+
60+
/**
61+
* When underTest we want exception that are deep inside the code to be surfaced to the test
62+
* @noreference This method is not intended to be referenced by clients.
63+
*/
64+
public static void setUnderTest(boolean underTest) {
65+
Logger.underTest = underTest;
66+
}
67+
5868
static {
5969
// Any of the known debugging options turns on the creation of the log file
6070
boolean createLogFile = TerminalPlugin.isOptionEnabled(TRACE_DEBUG_LOG)
@@ -187,6 +197,9 @@ public static final void logError(String message) {
187197
* Writes an exception to the Terminal log and the Eclipse log
188198
*/
189199
public static final void logException(Exception ex) {
200+
if (underTest) {
201+
throw new RuntimeException("Terminal Under Test - examine cause for real failure", ex); //$NON-NLS-1$
202+
}
190203
logStatus(new Status(IStatus.ERROR, TerminalPlugin.PLUGIN_ID, IStatus.OK, ex.getMessage(), ex));
191204
}
192205

0 commit comments

Comments
 (0)