Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1247)

Unified Diff: dart/compiler/javatests/com/google/dart/compiler/common/ErrorExpectation.java

Issue 20722006: Removed compiler/ directory from repository (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/compiler/javatests/com/google/dart/compiler/common/ErrorExpectation.java
diff --git a/dart/compiler/javatests/com/google/dart/compiler/common/ErrorExpectation.java b/dart/compiler/javatests/com/google/dart/compiler/common/ErrorExpectation.java
deleted file mode 100644
index e10948e6b80ee7622b0777c70551673f4435d89d..0000000000000000000000000000000000000000
--- a/dart/compiler/javatests/com/google/dart/compiler/common/ErrorExpectation.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-package com.google.dart.compiler.common;
-
-import com.google.dart.compiler.DartCompilationError;
-import com.google.dart.compiler.ErrorCode;
-
-import junit.framework.Assert;
-
-import java.util.List;
-
-public class ErrorExpectation {
- private final String sourceName;
- final ErrorCode errorCode;
- final int line;
- final int column;
- final int length;
-
- public ErrorExpectation(String sourceName, ErrorCode errorCode, int line, int column, int length) {
- this.sourceName = sourceName;
- this.errorCode = errorCode;
- this.line = line;
- this.column = column;
- this.length = length;
- }
-
- public static ErrorExpectation errEx(String sourceName,
- ErrorCode errorCode,
- int line,
- int column,
- int length) {
- sourceName = sourceName != null ? sourceName : "";
- return new ErrorExpectation(sourceName, errorCode, line, column, length);
- }
-
- public static ErrorExpectation errEx(ErrorCode errorCode, int line, int column, int length) {
- return new ErrorExpectation("", errorCode, line, column, length);
- }
-
- public static void formatExpectations(StringBuffer out,
- List<DartCompilationError> errors,
- ErrorExpectation[] expectedErrors) {
- out.append(String.format("Expected %d errors\n", expectedErrors.length));
- boolean hasExpectedSourceName = false;
- for (ErrorExpectation expected : expectedErrors) {
- hasExpectedSourceName |= expected.sourceName.length() != 0;
- out.append(String.format(
- " %s %s (%d,%d/%d)\n",
- expected.sourceName,
- expected.errorCode.toString(),
- expected.line,
- expected.column,
- expected.length));
- }
- out.append(String.format("Encountered %d errors\n", errors.size()));
- for (DartCompilationError actual : errors) {
- String sourceName =
- hasExpectedSourceName && actual.getSource() != null ? actual.getSource().getName() : "";
- out.append(String.format(
- " %s %s (%d,%d/%d): %s\n",
- sourceName,
- actual.getErrorCode().toString(),
- actual.getLineNumber(),
- actual.getColumnNumber(),
- actual.getLength(),
- actual.getMessage()));
- }
- }
-
- /**
- * Asserts that given list of {@link DartCompilationError} is exactly same as expected.
- */
- public static void assertErrors(List<DartCompilationError> errors,
- ErrorExpectation... expectedErrors) {
- StringBuffer errorMessage = new StringBuffer();
- // count of errors
- if (errors.size() != expectedErrors.length) {
- errorMessage.append(String.format(
- "Wrong number of errors encountered\n",
- expectedErrors.length,
- errors.size()));
- formatExpectations(errorMessage, errors, expectedErrors);
- } else {
- // content of errors
- for (int i = 0; i < expectedErrors.length; i++) {
- ErrorExpectation expected = expectedErrors[i];
- DartCompilationError actual = errors.get(i);
- String expectedSourceName = expected.sourceName;
- String actualSourceName = actual.getSource() != null ? actual.getSource().getName() : "";
- if (actual.getErrorCode() != expected.errorCode
- || actual.getLineNumber() != expected.line
- || actual.getColumnNumber() != expected.column
- || actual.getLength() != expected.length
- || !(expectedSourceName.length() == 0 || expectedSourceName.equals(actualSourceName))) {
- errorMessage.append(String.format("Expected errors didn't match actual\n"));
- formatExpectations(errorMessage, errors, expectedErrors);
- break;
- }
- }
- }
- // fail
- if (errorMessage.length() > 0) {
- System.err.println(errorMessage);
- Assert.fail(errorMessage.toString());
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698