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

Side by Side Diff: tests/lib_strong/mirrors/generic_interface_test.dart

Issue 2770063002: Revert "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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
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 test.generic_bounded; 5 library test.generic_bounded;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 10
11 import 'generics_helper.dart'; 11 import 'generics_helper.dart';
12 12
13 class Interface<T> {} 13 class Interface<T> {}
14
15 class Bounded<S extends num> {} 14 class Bounded<S extends num> {}
16 15
17 class Fixed implements Interface<int> {} 16 class Fixed implements Interface<int> {}
18
19 class Generic<R> implements Interface<R> {} 17 class Generic<R> implements Interface<R> {}
20 18
21 class Bienbounded implements Bounded<int> {} 19 class Bienbounded implements Bounded<int> {}
22
23 class Malbounded implements Bounded<String> {} // //# 01: static type warning 20 class Malbounded implements Bounded<String> {} // //# 01: static type warning
24 class FBounded implements Interface<FBounded> {} 21 class FBounded implements Interface<FBounded> {}
25 22
26 class Mixin {} 23 class Mixin {}
27
28 class FixedMixinApplication = Object with Mixin implements Interface<int>; 24 class FixedMixinApplication = Object with Mixin implements Interface<int>;
29 class GenericMixinApplication<X> = Object with Mixin implements Interface<X>; 25 class GenericMixinApplication<X> = Object with Mixin implements Interface<X>;
30
31 class FixedClass extends Object with Mixin implements Interface<int> {} 26 class FixedClass extends Object with Mixin implements Interface<int> {}
32
33 class GenericClass<Y> extends Object with Mixin implements Interface<Y> {} 27 class GenericClass<Y> extends Object with Mixin implements Interface<Y> {}
34 28
35 main() { 29 main() {
36 TypeMirror dynamicMirror = currentMirrorSystem().dynamicType; 30 TypeMirror dynamicMirror = currentMirrorSystem().dynamicType;
37 31
38 ClassMirror interfaceDecl = reflectClass(Interface); 32 ClassMirror interfaceDecl = reflectClass(Interface);
39 ClassMirror boundedDecl = reflectClass(Bounded); 33 ClassMirror boundedDecl = reflectClass(Bounded);
40 34
41 ClassMirror interfaceOfInt = reflectClass(Fixed).superinterfaces.single; 35 ClassMirror interfaceOfInt = reflectClass(Fixed).superinterfaces.single;
42 ClassMirror interfaceOfR = reflectClass(Generic).superinterfaces.single; 36 ClassMirror interfaceOfR = reflectClass(Generic).superinterfaces.single;
43 ClassMirror interfaceOfBool = 37 ClassMirror interfaceOfBool = reflect(new Generic<bool>()).type.superinterface s.single;
44 reflect(new Generic<bool>()).type.superinterfaces.single;
45 38
46 ClassMirror boundedOfInt = reflectClass(Bienbounded).superinterfaces.single; 39 ClassMirror boundedOfInt = reflectClass(Bienbounded).superinterfaces.single;
47 ClassMirror boundedOfString = reflectClass(Malbounded).superinterfaces.single; // //# 01: continued 40 ClassMirror boundedOfString = reflectClass(Malbounded).superinterfaces.single; // //# 01: continued
48 ClassMirror interfaceOfFBounded = 41 ClassMirror interfaceOfFBounded = reflectClass(FBounded).superinterfaces.singl e;
49 reflectClass(FBounded).superinterfaces.single; 42
50 43 ClassMirror interfaceOfInt2 = reflectClass(FixedMixinApplication).superinterfa ces.single;
51 ClassMirror interfaceOfInt2 = 44 ClassMirror interfaceOfX = reflectClass(GenericMixinApplication).superinterfac es.single;
52 reflectClass(FixedMixinApplication).superinterfaces.single; 45 ClassMirror interfaceOfDouble = reflect(new GenericMixinApplication<double>()) .type.superinterfaces.single;
53 ClassMirror interfaceOfX =
54 reflectClass(GenericMixinApplication).superinterfaces.single;
55 ClassMirror interfaceOfDouble = reflect(new GenericMixinApplication<double>())
56 .type
57 .superinterfaces
58 .single;
59 ClassMirror interfaceOfInt3 = reflectClass(FixedClass).superinterfaces.single; 46 ClassMirror interfaceOfInt3 = reflectClass(FixedClass).superinterfaces.single;
60 ClassMirror interfaceOfY = reflectClass(GenericClass).superinterfaces.single; 47 ClassMirror interfaceOfY = reflectClass(GenericClass).superinterfaces.single;
61 ClassMirror interfaceOfDouble2 = 48 ClassMirror interfaceOfDouble2 = reflect(new GenericClass<double>()).type.supe rinterfaces.single;
62 reflect(new GenericClass<double>()).type.superinterfaces.single; 49
63 50
64 Expect.isTrue(interfaceDecl.isOriginalDeclaration); 51 Expect.isTrue(interfaceDecl.isOriginalDeclaration);
65 Expect.isTrue(boundedDecl.isOriginalDeclaration); 52 Expect.isTrue(boundedDecl.isOriginalDeclaration);
66 53
67 Expect.isFalse(interfaceOfInt.isOriginalDeclaration); 54 Expect.isFalse(interfaceOfInt.isOriginalDeclaration);
68 Expect.isFalse(interfaceOfR.isOriginalDeclaration); 55 Expect.isFalse(interfaceOfR.isOriginalDeclaration);
69 Expect.isFalse(interfaceOfBool.isOriginalDeclaration); 56 Expect.isFalse(interfaceOfBool.isOriginalDeclaration);
70 Expect.isFalse(boundedOfInt.isOriginalDeclaration); 57 Expect.isFalse(boundedOfInt.isOriginalDeclaration);
71 Expect.isFalse(boundedOfString.isOriginalDeclaration); // //# 01: continued 58 Expect.isFalse(boundedOfString.isOriginalDeclaration); // //# 01: continued
72 Expect.isFalse(interfaceOfFBounded.isOriginalDeclaration); 59 Expect.isFalse(interfaceOfFBounded.isOriginalDeclaration);
73 Expect.isFalse(interfaceOfInt2.isOriginalDeclaration); 60 Expect.isFalse(interfaceOfInt2.isOriginalDeclaration);
74 Expect.isFalse(interfaceOfX.isOriginalDeclaration); 61 Expect.isFalse(interfaceOfX.isOriginalDeclaration);
75 Expect.isFalse(interfaceOfDouble.isOriginalDeclaration); 62 Expect.isFalse(interfaceOfDouble.isOriginalDeclaration);
76 Expect.isFalse(interfaceOfInt3.isOriginalDeclaration); 63 Expect.isFalse(interfaceOfInt3.isOriginalDeclaration);
77 Expect.isFalse(interfaceOfY.isOriginalDeclaration); 64 Expect.isFalse(interfaceOfY.isOriginalDeclaration);
78 Expect.isFalse(interfaceOfDouble2.isOriginalDeclaration); 65 Expect.isFalse(interfaceOfDouble2.isOriginalDeclaration);
79 66
67
80 TypeVariableMirror tFromInterface = interfaceDecl.typeVariables.single; 68 TypeVariableMirror tFromInterface = interfaceDecl.typeVariables.single;
81 TypeVariableMirror sFromBounded = boundedDecl.typeVariables.single; 69 TypeVariableMirror sFromBounded = boundedDecl.typeVariables.single;
82 TypeVariableMirror rFromGeneric = reflectClass(Generic).typeVariables.single; 70 TypeVariableMirror rFromGeneric = reflectClass(Generic).typeVariables.single;
83 TypeVariableMirror xFromGenericMixinApplication = 71 TypeVariableMirror xFromGenericMixinApplication = reflectClass(GenericMixinApp lication).typeVariables.single;
84 reflectClass(GenericMixinApplication).typeVariables.single; 72 TypeVariableMirror yFromGenericClass = reflectClass(GenericClass).typeVariable s.single;
85 TypeVariableMirror yFromGenericClass =
86 reflectClass(GenericClass).typeVariables.single;
87 73
88 Expect.equals(reflectClass(Object), tFromInterface.upperBound); 74 Expect.equals(reflectClass(Object), tFromInterface.upperBound);
89 Expect.equals(reflectClass(num), sFromBounded.upperBound); 75 Expect.equals(reflectClass(num), sFromBounded.upperBound);
90 Expect.equals(reflectClass(Object), rFromGeneric.upperBound); 76 Expect.equals(reflectClass(Object), rFromGeneric.upperBound);
91 Expect.equals(reflectClass(Object), xFromGenericMixinApplication.upperBound); 77 Expect.equals(reflectClass(Object), xFromGenericMixinApplication.upperBound);
92 Expect.equals(reflectClass(Object), yFromGenericClass.upperBound); 78 Expect.equals(reflectClass(Object), yFromGenericClass.upperBound);
93 79
80
94 typeParameters(interfaceDecl, [#T]); 81 typeParameters(interfaceDecl, [#T]);
95 typeParameters(boundedDecl, [#S]); 82 typeParameters(boundedDecl, [#S]);
96 typeParameters(interfaceOfInt, [#T]); 83 typeParameters(interfaceOfInt, [#T]);
97 typeParameters(interfaceOfR, [#T]); 84 typeParameters(interfaceOfR, [#T]);
98 typeParameters(interfaceOfBool, [#T]); 85 typeParameters(interfaceOfBool, [#T]);
99 typeParameters(boundedOfInt, [#S]); 86 typeParameters(boundedOfInt, [#S]);
100 typeParameters(boundedOfString, [#S]); // //# 01: continued 87 typeParameters(boundedOfString, [#S]); // //# 01: continued
101 typeParameters(interfaceOfFBounded, [#T]); 88 typeParameters(interfaceOfFBounded, [#T]);
102 typeParameters(interfaceOfInt2, [#T]); 89 typeParameters(interfaceOfInt2, [#T]);
103 typeParameters(interfaceOfX, [#T]); 90 typeParameters(interfaceOfX, [#T]);
(...skipping 10 matching lines...) Expand all
114 typeArguments(boundedOfInt, [reflectClass(int)]); 101 typeArguments(boundedOfInt, [reflectClass(int)]);
115 typeArguments(boundedOfString, [reflectClass(String)]); // //# 01: continued 102 typeArguments(boundedOfString, [reflectClass(String)]); // //# 01: continued
116 typeArguments(interfaceOfFBounded, [reflectClass(FBounded)]); 103 typeArguments(interfaceOfFBounded, [reflectClass(FBounded)]);
117 typeArguments(interfaceOfInt2, [reflectClass(int)]); 104 typeArguments(interfaceOfInt2, [reflectClass(int)]);
118 typeArguments(interfaceOfX, [xFromGenericMixinApplication]); 105 typeArguments(interfaceOfX, [xFromGenericMixinApplication]);
119 typeArguments(interfaceOfDouble, [reflectClass(double)]); 106 typeArguments(interfaceOfDouble, [reflectClass(double)]);
120 typeArguments(interfaceOfInt3, [reflectClass(int)]); 107 typeArguments(interfaceOfInt3, [reflectClass(int)]);
121 typeArguments(interfaceOfY, [yFromGenericClass]); 108 typeArguments(interfaceOfY, [yFromGenericClass]);
122 typeArguments(interfaceOfDouble2, [reflectClass(double)]); 109 typeArguments(interfaceOfDouble2, [reflectClass(double)]);
123 } 110 }
OLDNEW
« no previous file with comments | « tests/lib_strong/mirrors/generic_f_bounded_test.dart ('k') | tests/lib_strong/mirrors/generic_superclass_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698