ICU-11803 added 'main', simplified code for easier debugging

X-SVN-Rev: 37942
This commit is contained in:
Mark Davis 2015-09-10 12:14:46 +00:00
parent eef3e8f0f7
commit 1f9540cce1

View file

@ -1972,13 +1972,12 @@ public class TestFmwk extends AbstractTestLog {
// Return the source code location of the caller located callDepth frames up the stack.
public static String sourceLocation() {
// Walk up the stack to the first call site outside this file
StackTraceElement[] st = new Throwable().getStackTrace();
for (int i = 0; i < st.length; ++i) {
String source = st[i].getFileName();
for (StackTraceElement st : new Throwable().getStackTrace()) {
String source = st.getFileName();
if (!source.equals("TestFmwk.java") && !source.equals("AbstractTestLog.java")) {
String methodName = st[i].getMethodName();
if (methodName.startsWith("Test") || methodName.startsWith("test")) {
return "(" + source + ":" + st[i].getLineNumber() + ") ";
String methodName = st.getMethodName();
if (methodName.startsWith("Test") || methodName.startsWith("test") || methodName.equals("main")) {
return "(" + source + ":" + st.getLineNumber() + ") ";
}
}
}