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

Side by Side Diff: tests/compiler/dart2js/lookup_member_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « tests/compiler/dart2js/lookup_map_test.dart ('k') | tests/compiler/dart2js/loop_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library lookup_member_test; 5 library lookup_member_test;
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import 'type_test_helper.dart'; 9 import 'type_test_helper.dart';
10 import 'package:compiler/src/dart_types.dart'; 10 import 'package:compiler/src/dart_types.dart';
11 import "package:compiler/src/elements/elements.dart" 11 import "package:compiler/src/elements/elements.dart"
12 show Element, ClassElement, MemberSignature, PublicName; 12 show Element, ClassElement, MemberSignature, PublicName;
13 13
14 void main() { 14 void main() {
15 test(); 15 test();
16 } 16 }
17 17
18 void test() { 18 void test() {
19 asyncTest(() => TypeEnvironment.create(r""" 19 asyncTest(() => TypeEnvironment.create(r"""
20 class A<T> { 20 class A<T> {
21 T foo; 21 T foo;
22 } 22 }
23 class B<S> extends A<A<S>> { 23 class B<S> extends A<A<S>> {
24 S bar; 24 S bar;
25 } 25 }
26 class C<U> extends B<String> with D<B<U>> { 26 class C<U> extends B<String> with D<B<U>> {
27 U baz; 27 U baz;
28 } 28 }
29 class D<V> { 29 class D<V> {
30 V boz; 30 V boz;
31 } 31 }
32 """).then((env) { 32 """).then((env) {
33 void expect(InterfaceType receiverType, String memberName, 33 void expect(InterfaceType receiverType, String memberName,
34 DartType expectedType) { 34 DartType expectedType) {
35 MemberSignature member = receiverType.lookupInterfaceMember( 35 MemberSignature member =
36 new PublicName(memberName)); 36 receiverType.lookupInterfaceMember(new PublicName(memberName));
37 Expect.isNotNull(member); 37 Expect.isNotNull(member);
38 DartType memberType = member.type; 38 DartType memberType = member.type;
39 Expect.equals(expectedType, memberType, 39 Expect.equals(expectedType, memberType,
40 'Wrong member type for $receiverType.$memberName.'); 40 'Wrong member type for $receiverType.$memberName.');
41 } 41 }
42 42
43 DartType int_ = env['int']; 43 DartType int_ = env['int'];
44 DartType String_ = env['String']; 44 DartType String_ = env['String'];
45 45
46 ClassElement A = env.getElement('A'); 46 ClassElement A = env.getElement('A');
47 DartType T = A.typeVariables.first; 47 DartType T = A.typeVariables.first;
48 DartType A_T = A.thisType; 48 DartType A_T = A.thisType;
49 expect(A_T, 'foo', T); 49 expect(A_T, 'foo', T);
50 50
51 DartType A_int = instantiate(A, [int_]); 51 DartType A_int = instantiate(A, [int_]);
52 expect(A_int, 'foo', int_); 52 expect(A_int, 'foo', int_);
53 53
54 ClassElement B = env.getElement('B'); 54 ClassElement B = env.getElement('B');
55 DartType S = B.typeVariables.first; 55 DartType S = B.typeVariables.first;
56 DartType B_S = B.thisType; 56 DartType B_S = B.thisType;
57 expect(B_S, 'foo', instantiate(A, [S])); 57 expect(B_S, 'foo', instantiate(A, [S]));
58 expect(B_S, 'bar', S); 58 expect(B_S, 'bar', S);
59 59
60 DartType B_int = instantiate(B, [int_]); 60 DartType B_int = instantiate(B, [int_]);
61 expect(B_int, 'foo', A_int); 61 expect(B_int, 'foo', A_int);
62 expect(B_int, 'bar', int_); 62 expect(B_int, 'bar', int_);
63 63
64 ClassElement C = env.getElement('C'); 64 ClassElement C = env.getElement('C');
65 DartType U = C.typeVariables.first; 65 DartType U = C.typeVariables.first;
66 DartType C_U = C.thisType; 66 DartType C_U = C.thisType;
67 expect(C_U, 'foo', instantiate(A, [String_])); 67 expect(C_U, 'foo', instantiate(A, [String_]));
68 expect(C_U, 'bar', String_); 68 expect(C_U, 'bar', String_);
69 expect(C_U, 'baz', U); 69 expect(C_U, 'baz', U);
70 expect(C_U, 'boz', instantiate(B, [U])); 70 expect(C_U, 'boz', instantiate(B, [U]));
71 71
72 DartType C_int = instantiate(C, [int_]); 72 DartType C_int = instantiate(C, [int_]);
73 expect(C_int, 'foo', instantiate(A, [String_])); 73 expect(C_int, 'foo', instantiate(A, [String_]));
74 expect(C_int, 'bar', String_); 74 expect(C_int, 'bar', String_);
75 expect(C_int, 'baz', int_); 75 expect(C_int, 'baz', int_);
76 expect(C_int, 'boz', instantiate(B, [int_])); 76 expect(C_int, 'boz', instantiate(B, [int_]));
77 })); 77 }));
78 } 78 }
79
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/lookup_map_test.dart ('k') | tests/compiler/dart2js/loop_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698