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

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java

Issue 10695067: Added a few tests, removed some error codes from Resolver (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: # Created 8 years, 6 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/resolver/ResolverTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
index d95f17532a850f5721c9cabc040bcbfd4a9ba4a9..a14d269a1563a142ffbfcb18278e8bcac4ce1e96 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java
@@ -19,7 +19,6 @@ import static com.google.dart.compiler.common.ErrorExpectation.errEx;
import junit.framework.Assert;
import java.util.List;
-import java.util.Map;
/**
* Basic tests of the resolver.
@@ -1507,7 +1506,7 @@ public class ResolverTest extends ResolverTestCase {
errEx(ResolverErrorCode.INSTANCE_METHOD_FROM_INITIALIZER, 5, 13, 3));
}
- public void testRedirectConstructor() {
+ public void test_redirectConstructor() {
resolveAndTest(Joiner.on("\n").join(
"class Object {}",
"interface int {}",
@@ -1524,4 +1523,38 @@ public class ResolverTest extends ResolverTestCase {
"}"),
errEx(ResolverErrorCode.INSTANCE_METHOD_FROM_REDIRECT, 10, 21, 8));
}
+
+ public void test_fieldAccessInInitializer() throws Exception {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class A {",
+ " var f1;",
+ " var f2;",
+ " A() : this.f2 = f1;",
+ "}"),
+ errEx(ResolverErrorCode.CANNOT_ACCESS_FIELD_IN_INIT, 5, 19, 2));
+ }
+
+ public void test_cannotBeResolved() throws Exception {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "class A {",
+ " static var field = B;",
+ " }",
+ "method() {",
+ " A.noField = 1;",
+ "}"),
+ errEx(ResolverErrorCode.CANNOT_BE_RESOLVED, 3, 22, 1),
+ errEx(ResolverErrorCode.CANNOT_BE_RESOLVED, 6, 5, 7));
+ }
+
+ public void test_invokeTypeAlias() throws Exception {
+ resolveAndTest(Joiner.on("\n").join(
+ "class Object {}",
+ "typedef Object func();",
+ "method() {",
+ " func();",
+ "}"),
+ errEx(ResolverErrorCode.CANNOT_CALL_FUNCTION_TYPE_ALIAS, 4, 3, 6));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698