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

Unified Diff: compiler/javatests/com/google/dart/compiler/PrettyErrorFormatterTest.java

Issue 10704180: Use 'int' instead of Position. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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: compiler/javatests/com/google/dart/compiler/PrettyErrorFormatterTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/PrettyErrorFormatterTest.java b/compiler/javatests/com/google/dart/compiler/PrettyErrorFormatterTest.java
index c75a0ee8f9f262ba613d57fa511073d5fd8b5eaf..b6ebc5d07298f986f139ee80818377ec8f4a1788 100644
--- a/compiler/javatests/com/google/dart/compiler/PrettyErrorFormatterTest.java
+++ b/compiler/javatests/com/google/dart/compiler/PrettyErrorFormatterTest.java
@@ -6,10 +6,11 @@ package com.google.dart.compiler;
import com.google.common.base.Joiner;
import com.google.dart.compiler.CompilerConfiguration.ErrorFormat;
import com.google.dart.compiler.parser.DartScanner.Location;
-import com.google.dart.compiler.parser.DartScanner.Position;
import com.google.dart.compiler.resolver.ResolverErrorCode;
import com.google.dart.compiler.resolver.TypeErrorCode;
+import com.sun.tools.javac.util.Position;
+
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
@@ -41,7 +42,7 @@ public class PrettyErrorFormatterTest extends TestCase {
return null;
}
};
- Location location = new Location(new Position(-1, 1, 3));
+ Location location = new Location(2);
DartCompilationError error =
new DartCompilationError(emptyDartSource, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -69,7 +70,7 @@ public class PrettyErrorFormatterTest extends TestCase {
};
}
};
- Location location = new Location(new Position(-1, 1, 3));
+ Location location = new Location(2);
DartCompilationError error =
new DartCompilationError(badDartSource, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -84,7 +85,7 @@ public class PrettyErrorFormatterTest extends TestCase {
*/
public void test_emptyDartSource() throws Exception {
Source emptyDartSource = new DartSourceTest("my/path/Test.dart", "", new MockLibrarySource());
- Location location = new Location(new Position(-1, 1, 3));
+ Location location = new Location(2);
DartCompilationError error =
new DartCompilationError(emptyDartSource, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -98,7 +99,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* Error on first line, so no previous line printed.
*/
public void test_noColor_notMachine_firstLine() throws Exception {
- Location location = new Location(new Position(3, 1, 3), new Position(6, 1, 6));
+ Location location = new Location(2, 5);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -116,7 +117,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* {@link Location} with single {@link Position}, underline single character.
*/
public void test_noColor_notMachine_singlePosition() throws Exception {
- Location location = new Location(new Position(-1, 2, 3));
+ Location location = new Location(10);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -135,7 +136,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* {@link Location} with single {@link Position}, underline single character.
*/
public void test_withColor_notMachine_singlePosition() throws Exception {
- Location location = new Location(new Position(-1, 2, 3));
+ Location location = new Location(10);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
String errorString = getErrorString(error, true, false);
@@ -166,7 +167,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* Underline range of characters.
*/
public void test_noColor_notMachine() throws Exception {
- Location location = new Location(new Position(8 + 3, 2, 3), new Position(8 + 6, 2, 6));
+ Location location = new Location(10, 10 + 3);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -185,7 +186,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* Use color to highlight range of characters.
*/
public void test_withColor_notMachine() throws Exception {
- Location location = new Location(new Position(8 + 3, 2, 3), new Position(8 + 6, 2, 6));
+ Location location = new Location(10, 10 + 3);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
String errorString = getErrorString(error, true, false);
@@ -216,7 +217,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* Include all information about error context.
*/
public void test_noColor_forMachine() throws Exception {
- Location location = new Location(new Position(8 + 3, 2, 3), new Position(8 + 7, 2, 7));
+ Location location = new Location(10, 10 + 4);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
//
@@ -235,7 +236,7 @@ public class PrettyErrorFormatterTest extends TestCase {
* Use color to highlight range of characters. Include all information about error context.
*/
public void test_withColor_forMachine() throws Exception {
- Location location = new Location(new Position(8 + 3, 2, 3), new Position(8 + 7, 2, 7));
+ Location location = new Location(10, 10 + 4);
DartCompilationError error =
new DartCompilationError(SOURCE, location, TypeErrorCode.NO_SUCH_TYPE, "Foo");
String errorString = getErrorString(error, true, true);

Powered by Google App Engine
This is Rietveld 408576698