Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit817a4b2

Browse files
author
jossonsmith
committed
Merge with trunk for supporting Test Suites
1 parent8dc971e commit817a4b2

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎src/net/sf/j2s/ui/launching/J2SUnitLaunchingUtil.java‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
importjava.util.HashSet;
1111
importjava.util.Properties;
1212
importjava.util.Set;
13+
importnet.sf.j2s.core.astvisitors.Bindings;
1314
importnet.sf.j2s.core.astvisitors.DependencyASTVisitor;
1415
importnet.sf.j2s.ui.classpath.CompositeResources;
1516
importnet.sf.j2s.ui.classpath.ContactedClasses;
@@ -28,7 +29,10 @@
2829
importorg.eclipse.debug.core.ILaunchConfiguration;
2930
importorg.eclipse.jdt.core.IJavaModel;
3031
importorg.eclipse.jdt.core.IJavaProject;
32+
importorg.eclipse.jdt.core.IMethod;
33+
importorg.eclipse.jdt.core.IType;
3134
importorg.eclipse.jdt.core.JavaCore;
35+
importorg.eclipse.jdt.internal.corext.util.JavaModelUtil;
3236
importorg.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
3337
importorg.eclipse.jface.dialogs.MessageDialog;
3438
importorg.eclipse.swt.widgets.Display;
@@ -642,7 +646,23 @@ private static String generateHTML(ILaunchConfiguration configuration,
642646
buf.append("ClazzLoader.loadClass (\"junit.textui.TestRunner\", function () {\r\n");
643647
buf.append("ClazzLoader.loadClass (\"" +mainType +"\", function () {\r\n");
644648
//buf.append("" + mainType + ".main(" + ArgsUtil.wrapAsArgumentArray(args) + ");\r\n");
645-
buf.append("junit.textui.TestRunner.run (" +mainType +");\r\n");
649+
ITypemType =JavaModelUtil.findType(javaProject,mainType);
650+
booleanisTestSuite =false;
651+
if (mType !=null) {
652+
IMethodsuiteMethod =JavaModelUtil.findMethod("suite",newString[0],false,mType);
653+
if (suiteMethod !=null) {
654+
StringreturnType =suiteMethod.getReturnType();
655+
if ("QTest;".equals(returnType)
656+
||"Qjunit.framework.Test;".equals(returnType) ) {
657+
isTestSuite =true;
658+
}
659+
}
660+
}
661+
if (isTestSuite) {
662+
buf.append("junit.textui.TestRunner.run (" +mainType +".suite ());\r\n");
663+
}else {
664+
buf.append("junit.textui.TestRunner.run (" +mainType +");\r\n");
665+
}
646666
buf.append("});\r\n");
647667
buf.append("});\r\n");
648668
buf.append("</script>\r\n");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp