| Index: dart/compiler/javatests/com/google/dart/compiler/end2end/End2EndTestCase.java
|
| diff --git a/dart/compiler/javatests/com/google/dart/compiler/end2end/End2EndTestCase.java b/dart/compiler/javatests/com/google/dart/compiler/end2end/End2EndTestCase.java
|
| index a6efac3579fbe2ffd26406cbf17b4df990ad21aa..b3bb6b59f9388f3b226aaaa20dc1a7c9ddf62253 100644
|
| --- a/dart/compiler/javatests/com/google/dart/compiler/end2end/End2EndTestCase.java
|
| +++ b/dart/compiler/javatests/com/google/dart/compiler/end2end/End2EndTestCase.java
|
| @@ -16,27 +16,20 @@ import com.google.dart.compiler.DartSourceTest;
|
| import com.google.dart.compiler.DefaultCompilerConfiguration;
|
| import com.google.dart.compiler.LibrarySource;
|
| import com.google.dart.compiler.MockLibrarySource;
|
| -import com.google.dart.compiler.backend.js.ClosureJsBackend;
|
| import com.google.dart.compiler.backend.js.JavascriptBackend;
|
| import com.google.dart.runner.DartRunner;
|
| import com.google.dart.runner.RunnerError;
|
|
|
| import org.kohsuke.args4j.CmdLineException;
|
| -import org.mozilla.javascript.RhinoException;
|
|
|
| import java.util.List;
|
|
|
| /**
|
| - * Abstract base for end-to-end tests. Tests are entirely Dart code that are compiled and run
|
| - * within Rhino or V8.
|
| + * Abstract base for end-to-end tests. Tests are entirely Dart code
|
| + * that are compiled and run within V8.
|
| */
|
| public abstract class End2EndTestCase extends CompilerTestCase {
|
|
|
| - enum OptimizationLevel {
|
| - RAW,
|
| - APP
|
| - }
|
| -
|
| /**
|
| * Creates an ApplicationSource that should be compiled and executed.
|
| *
|
| @@ -56,34 +49,27 @@ public abstract class End2EndTestCase extends CompilerTestCase {
|
| /**
|
| * Creates a compiler configuration appropriate for the optimization level.
|
| */
|
| - CompilerConfiguration getCompilerConfiguration(OptimizationLevel opLevel) {
|
| - switch (opLevel) {
|
| - case RAW:
|
| - return new DefaultCompilerConfiguration(new JavascriptBackend());
|
| - case APP:
|
| - return new DefaultCompilerConfiguration(new ClosureJsBackend());
|
| - }
|
| - throw new IllegalStateException("unexpected opLevel");
|
| + CompilerConfiguration getCompilerConfiguration() {
|
| + return new DefaultCompilerConfiguration(new JavascriptBackend());
|
| }
|
|
|
| /**
|
| * Runs an end-to-end Dart test for the given compilation unit.
|
| */
|
| - protected void runTest(LibrarySource app, OptimizationLevel opLevel,
|
| - DartCompilerListener listener) {
|
| - runTest(app, opLevel, listener, new String[0]);
|
| + protected void runTest(LibrarySource app, DartCompilerListener listener) {
|
| + runTest(app, listener, new String[0]);
|
| }
|
|
|
| - protected void runTest(LibrarySource app, OptimizationLevel opLevel,
|
| + protected void runTest(LibrarySource app,
|
| DartCompilerListener listener, String[] args) {
|
| - final CompilerConfiguration config = getCompilerConfiguration(opLevel);
|
| - runTest(app, opLevel, listener, config, args);
|
| + final CompilerConfiguration config = getCompilerConfiguration();
|
| + runTest(app, listener, config, args);
|
| }
|
|
|
| /**
|
| * Runs an end-to-end Dart test for the given compilation unit.
|
| */
|
| - protected void runTest(LibrarySource app, OptimizationLevel opLevel,
|
| + protected void runTest(LibrarySource app,
|
| DartCompilerListener listener,
|
| CompilerConfiguration config, String[] args) {
|
| DartRunnerOptions verboseOptions = new CommandLineOptions.DartRunnerOptions();
|
| @@ -91,18 +77,6 @@ public abstract class End2EndTestCase extends CompilerTestCase {
|
| try {
|
| DartRunner.compileAndRunApp(app, verboseOptions, config, listener, args,
|
| System.out, System.err);
|
| - } catch (RhinoException e) {
|
| - // TODO(jgw): This is a hack to dump the translated source when something goes wrong. It can
|
| - // be removed as soon as we have a source map we can use to provide source-level errors.
|
| -
|
| - // TODO(floitsch): clean up the exception handling. Who prints what, and when?
|
| -
|
| - StringBuffer msg = new StringBuffer();
|
| - msg.append("optimization level: " + opLevel.toString() + "\n");
|
| - msg.append(e.sourceName());
|
| - msg.append(" (" + e.lineNumber() + ":" + e.columnNumber() + ")");
|
| - msg.append(" : " + e.details());
|
| - fail(msg.toString());
|
| } catch (RunnerError e) {
|
| fail(e.getLocalizedMessage());
|
| }
|
| @@ -111,9 +85,9 @@ public abstract class End2EndTestCase extends CompilerTestCase {
|
| /**
|
| * Runs an end-to-end Dart test for the given compilation unit.
|
| */
|
| - protected void runTest(LibrarySource app, OptimizationLevel opLevel) {
|
| + protected void runTest(LibrarySource app) {
|
| DartCompilerListener listener = new DartCompilerListenerTest(null);
|
| - runTest(app, opLevel, listener);
|
| + runTest(app, listener);
|
| }
|
|
|
| /**
|
| @@ -124,7 +98,6 @@ public abstract class End2EndTestCase extends CompilerTestCase {
|
| CompilerOptions options = processCommandLineOptions(args);
|
| DefaultCompilerConfiguration config = new DefaultCompilerConfiguration(options);
|
| runTest(new DartLibrarySourceTest(getClass(), appSrc),
|
| - OptimizationLevel.RAW,
|
| listener,
|
| config,
|
| args);
|
| @@ -136,14 +109,12 @@ public abstract class End2EndTestCase extends CompilerTestCase {
|
| * @param srcs path to the Dart source files containing the test
|
| * @param opLevel The type of optimization to perform on the test code.
|
| */
|
| - protected void runTest(
|
| - List<String> srcs, OptimizationLevel opLevel)
|
| - throws SecurityException {
|
| - runTest(createApplication(srcs), opLevel);
|
| + protected void runTest(List<String> srcs) throws SecurityException {
|
| + runTest(createApplication(srcs));
|
| }
|
|
|
| protected void runTest(String appSrc) throws Exception {
|
| - runTest(new DartLibrarySourceTest(getClass(), appSrc), OptimizationLevel.RAW);
|
| + runTest(new DartLibrarySourceTest(getClass(), appSrc));
|
| }
|
|
|
| protected static CompilerOptions processCommandLineOptions(String[] args) {
|
|
|