public void runConformTest( String fileName, String fileContents, Parser parser, ASTCollector visitor, String expected) { CompilationUnit source = new CompilationUnit(fileContents.toCharArray(), fileName, null); CompilationResult compilationResult = new CompilationResult(source, 1, 1, 10); CompilationUnitDeclaration unit = parser.parse(source, compilationResult); assertEquals(0, compilationResult.problemCount); unit.traverse(visitor, unit.scope); String result = visitor.result(); if (!expected.equals(result)) { System.out.println(getClass().getName() + '#' + getName()); System.out.println("Expected:"); System.out.println(expected); System.out.println("But was:"); System.out.println(result); System.out.println("Cut and paste:"); System.out.println(Util.displayString(result, INDENT, SHIFT)); } assertEquals(expected, result); }
public void endVisit(StringLiteralConcatenation literal, BlockScope scope) { this.collector.append("[ev SLC " + cut(literal.toString()) + "]\n"); super.endVisit(literal, scope); }
public void endVisit(StringLiteral stringLiteral, BlockScope scope) { this.collector.append("[ev SL " + cut(stringLiteral.toString()) + "]\n"); super.endVisit(stringLiteral, scope); }
public void endVisit(SingleNameReference singleNameReference, BlockScope scope) { this.collector.append("[ev SNR " + cut(singleNameReference.toString()) + "]\n"); super.endVisit(singleNameReference, scope); }
public void endVisit(ExtendedStringLiteral literal, BlockScope scope) { this.collector.append("[ev ESL " + cut(literal.toString()) + "]\n"); super.endVisit(literal, scope); }
public void endVisit(CharLiteral charLiteral, BlockScope scope) { this.collector.append("[ev CL " + cut(charLiteral.toString()) + "]\n"); super.endVisit(charLiteral, scope); }
public void endVisit(BinaryExpression binaryExpression, BlockScope scope) { this.collector.append("[ev BE " + cut(binaryExpression.toString()) + "]\n"); super.endVisit(binaryExpression, scope); }