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

Unified Diff: tests/compiler/dart2js/lookup_member_test.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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: tests/compiler/dart2js/lookup_member_test.dart
diff --git a/tests/compiler/dart2js/lookup_member_test.dart b/tests/compiler/dart2js/lookup_member_test.dart
index ea1d687c3895a99b7469563c35384106dc81826d..3f925d6d467f27d1757bbe72011facbb6024fc63 100644
--- a/tests/compiler/dart2js/lookup_member_test.dart
+++ b/tests/compiler/dart2js/lookup_member_test.dart
@@ -15,7 +15,7 @@ void main() {
}
void test() {
- var env = new TypeEnvironment(r"""
+ TypeEnvironment.create(r"""
class A<T> {
T foo;
}
@@ -28,49 +28,49 @@ void test() {
class D<V> {
V boz;
}
- """);
+ """).then((env) {
+ void expect(DartType receiverType, String memberName, DartType expectedType) {
+ Member member = receiverType.lookupMember(env.sourceString(memberName));
+ Expect.isNotNull(member);
+ DartType memberType = member.computeType(env.compiler);
+ Expect.equals(expectedType, memberType,
+ 'Wrong member type for $receiverType.$memberName.');
+ }
- void expect(DartType receiverType, String memberName, DartType expectedType) {
- Member member = receiverType.lookupMember(env.sourceString(memberName));
- Expect.isNotNull(member);
- DartType memberType = member.computeType(env.compiler);
- Expect.equals(expectedType, memberType,
- 'Wrong member type for $receiverType.$memberName.');
- }
+ DartType int_ = env['int'];
+ DartType String_ = env['String'];
- DartType int_ = env['int'];
- DartType String_ = env['String'];
+ ClassElement A = env.getElement('A');
+ DartType T = A.typeVariables.head;
+ DartType A_T = A.thisType;
+ expect(A_T, 'foo', T);
- ClassElement A = env.getElement('A');
- DartType T = A.typeVariables.head;
- DartType A_T = A.thisType;
- expect(A_T, 'foo', T);
+ DartType A_int = instantiate(A, [int_]);
+ expect(A_int, 'foo', int_);
- DartType A_int = instantiate(A, [int_]);
- expect(A_int, 'foo', int_);
+ ClassElement B = env.getElement('B');
+ DartType S = B.typeVariables.head;
+ DartType B_S = B.thisType;
+ expect(B_S, 'foo', instantiate(A, [S]));
+ expect(B_S, 'bar', S);
- ClassElement B = env.getElement('B');
- DartType S = B.typeVariables.head;
- DartType B_S = B.thisType;
- expect(B_S, 'foo', instantiate(A, [S]));
- expect(B_S, 'bar', S);
+ DartType B_int = instantiate(B, [int_]);
+ expect(B_int, 'foo', A_int);
+ expect(B_int, 'bar', int_);
- DartType B_int = instantiate(B, [int_]);
- expect(B_int, 'foo', A_int);
- expect(B_int, 'bar', int_);
+ ClassElement C = env.getElement('C');
+ DartType U = C.typeVariables.head;
+ DartType C_U = C.thisType;
+ expect(C_U, 'foo', instantiate(A, [String_]));
+ expect(C_U, 'bar', String_);
+ expect(C_U, 'baz', U);
+ expect(C_U, 'boz', instantiate(B, [U]));
- ClassElement C = env.getElement('C');
- DartType U = C.typeVariables.head;
- DartType C_U = C.thisType;
- expect(C_U, 'foo', instantiate(A, [String_]));
- expect(C_U, 'bar', String_);
- expect(C_U, 'baz', U);
- expect(C_U, 'boz', instantiate(B, [U]));
-
- DartType C_int = instantiate(C, [int_]);
- expect(C_int, 'foo', instantiate(A, [String_]));
- expect(C_int, 'bar', String_);
- expect(C_int, 'baz', int_);
- expect(C_int, 'boz', instantiate(B, [int_]));
+ DartType C_int = instantiate(C, [int_]);
+ expect(C_int, 'foo', instantiate(A, [String_]));
+ expect(C_int, 'bar', String_);
+ expect(C_int, 'baz', int_);
+ expect(C_int, 'boz', instantiate(B, [int_]));
+ });
}

Powered by Google App Engine
This is Rietveld 408576698