/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
public class AbstractCompilerTest extends TestCase {
-// public static final String COMPLIANCE_1_3 = "1.3";
-// public static final String COMPLIANCE_1_4 = "1.4";
-// public static final String COMPLIANCE_1_5 = "1.5";
-//
-// public static final int F_1_3 = 0x1;
-// public static final int F_1_4 = 0x2;
-// public static final int F_1_5 = 0x4;
-
private static int possibleComplianceLevels = -1;
protected String complianceLevel;
public void checkParsePHP(
- char[] source,
+ char[] source,
String expectedSyntaxErrorDiagnosis) {
// String testName) {
- UnitParser parser =
+ UnitParser parser =
new UnitParser(
new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(getCompilerOptions()),
+ DefaultErrorHandlingPolicies.proceedWithAllProblems(),
+ new CompilerOptions(getCompilerOptions()),
new DefaultProblemFactory(Locale.getDefault())));
ICompilationUnit sourceUnit = new CompilationUnit(source, "", null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
+ CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
+
CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, true);
// if (computedUnit.types != null) {
// for (int i = computedUnit.types.size(); --i >= 0;){
int count = problems.length;
int problemCount = 0;
char[] unitSource = compilationResult.compilationUnit.getContents();
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
if (problems[i] != null) {
if (problemCount == 0)
buffer.append("----------\n");
computedSyntaxErrorDiagnosis);
}
public void checkParseHTML(
- char[] source,
+ char[] source,
String expectedSyntaxErrorDiagnosis) {
// String testName) {
- UnitParser parser =
+ UnitParser parser =
new UnitParser(
new ProblemReporter(
- DefaultErrorHandlingPolicies.proceedWithAllProblems(),
- new CompilerOptions(getCompilerOptions()),
+ DefaultErrorHandlingPolicies.proceedWithAllProblems(),
+ new CompilerOptions(getCompilerOptions()),
new DefaultProblemFactory(Locale.getDefault())));
ICompilationUnit sourceUnit = new CompilationUnit(source, "", null);
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
-
+ CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
+
CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, false);
// if (computedUnit.types != null) {
// for (int i = computedUnit.types.size(); --i >= 0;){
int count = problems.length;
int problemCount = 0;
char[] unitSource = compilationResult.compilationUnit.getContents();
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
if (problems[i] != null) {
if (problemCount == 0)
buffer.append("----------\n");
// }
/*
- * Returns a test suite including the tests defined by the given classes for all possible complianceLevels
- * and using the given setup class (CompilerTestSetup or a subclass)
- */
-// public static Test suite(String suiteName, Class setupClass, ArrayList testClasses) {
-// TestSuite all = new TestSuite(suiteName);
-// int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
-// if ((complianceLevels & AbstractCompilerTest.F_1_3) != 0) {
-// all.addTest(suiteForComplianceLevel(COMPLIANCE_1_3, setupClass, testClasses));
-// }
-// if ((complianceLevels & AbstractCompilerTest.F_1_4) != 0) {
-// all.addTest(suiteForComplianceLevel(COMPLIANCE_1_4, setupClass, testClasses));
-// }
-// if ((complianceLevels & AbstractCompilerTest.F_1_5) != 0) {
-// all.addTest(suiteForComplianceLevel(COMPLIANCE_1_5, setupClass, testClasses));
-// }
-// return all;
-// }
-
- /*
- * Returns a test suite including the tests defined by the given classes for the given complianceLevel
+ * Returns a test suite including the tests defined by the given classes for the given complianceLevel
* (see AbstractCompilerTest for valid values) and using the given setup class (CompilerTestSetup or a subclass)
*/
public static Test suiteForComplianceLevel(String complianceLevel, Class setupClass, ArrayList testClasses) {
options.put(CompilerOptions.OPTION_PHPBadStyleUppercaseIdentifierWarning, CompilerOptions.IGNORE);
options.put(CompilerOptions.OPTION_PHPIncludeNotExistWarning, CompilerOptions.IGNORE);
options.put(CompilerOptions.OPTION_UninitializedLocalVariableWarning, CompilerOptions.IGNORE);
-
+ options.put(CompilerOptions.OPTION_CodeCannotBeReachedWarning, CompilerOptions.IGNORE);
return options;
}