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

Side by Side Diff: test_reflectable/test/reflected_type_test.dart

Issue 1473073009: Added `dynamicReflected..Type`, corrected type expressions. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Review response. Created 5 years 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 | « test_reflectable/test/new_instance_test.dart ('k') | no next file » | 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) 2015, the Dart Team. All rights reserved. Use of this 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in 2 // source code is governed by a BSD-style license that can be found in
3 // the LICENSE file. 3 // the LICENSE file.
4 4
5 // File being transformed by the reflectable transformer. 5 // File being transformed by the reflectable transformer.
6 // Uses `reflectedType` to access a `Type` value for the type annotation 6 // Uses `reflectedType` to access a `Type` value for the type annotation
7 // of various declarations. 7 // of various declarations.
8 8
9 library test_reflectable.test.reflected_type_test; 9 library test_reflectable.test.reflected_type_test;
10 10
(...skipping 21 matching lines...) Expand all
32 32
33 String get getset => "42"; 33 String get getset => "42";
34 void set getset(String string) {} 34 void set getset(String string) {}
35 35
36 static int noArguments() => null; 36 static int noArguments() => null;
37 static int oneArgument(String x) => null; 37 static int oneArgument(String x) => null;
38 static int optionalArguments(A x, double y, [Reflector z, dynamic w = 42]) => 38 static int optionalArguments(A x, double y, [Reflector z, dynamic w = 42]) =>
39 null; 39 null;
40 static int namedArguments(String x, List y, {String z: "4" + "2"}) => null; 40 static int namedArguments(String x, List y, {String z: "4" + "2"}) => null;
41 41
42 static List get staticGetset => ["42"]; 42 static List<String> get staticGetset => ["42"];
43 static void set staticGetset(List list) {} 43 static void set staticGetset(List<String> list) {}
44 } 44 }
45 45
46 final throwsNoCapability = throwsA(const isInstanceOf<NoSuchCapabilityError>()); 46 final throwsNoCapability = throwsA(const isInstanceOf<NoSuchCapabilityError>());
47 47
48 main() { 48 main() {
49 ClassMirror aMirror = reflector.reflectType(A); 49 ClassMirror aMirror = reflector.reflectType(A);
50 Map<String, DeclarationMirror> declarations = aMirror.declarations; 50 Map<String, DeclarationMirror> declarations = aMirror.declarations;
51 51
52 MethodMirror arg0Mirror = declarations["arg0"]; 52 MethodMirror arg0Mirror = declarations["arg0"];
53 MethodMirror arg1Mirror = declarations["arg1"]; 53 MethodMirror arg1Mirror = declarations["arg1"];
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 expect(namedArgumentsParameter0.reflectedType, String); 136 expect(namedArgumentsParameter0.reflectedType, String);
137 expect(namedArgumentsParameter1.reflectedType, List); 137 expect(namedArgumentsParameter1.reflectedType, List);
138 expect(namedArgumentsParameter2.reflectedType, String); 138 expect(namedArgumentsParameter2.reflectedType, String);
139 }); 139 });
140 140
141 test('parameter reflected types, static getters and setters', () { 141 test('parameter reflected types, static getters and setters', () {
142 expect(staticGetsetMirror.parameters.length, 0); 142 expect(staticGetsetMirror.parameters.length, 0);
143 expect(staticGetsetEqualsMirror.parameters.length, 1); 143 expect(staticGetsetEqualsMirror.parameters.length, 1);
144 ParameterMirror staticGetsetEqualsParameter0 = 144 ParameterMirror staticGetsetEqualsParameter0 =
145 staticGetsetEqualsMirror.parameters[0]; 145 staticGetsetEqualsMirror.parameters[0];
146 expect(staticGetsetEqualsParameter0.reflectedType, List); 146 expect(staticGetsetEqualsParameter0.reflectedType,
147 const TypeValue<List<String>>().type);
147 }); 148 });
148 149
149 test('reflected return types, methods', () { 150 test('reflected return types, methods', () {
150 expect(arg0Mirror.reflectedReturnType, int); 151 expect(arg0Mirror.reflectedReturnType, int);
151 expect(arg1Mirror.reflectedReturnType, int); 152 expect(arg1Mirror.reflectedReturnType, int);
152 expect(arg2to4Mirror.reflectedReturnType, int); 153 expect(arg2to4Mirror.reflectedReturnType, int);
153 expect(argNamedMirror.reflectedReturnType, int); 154 expect(argNamedMirror.reflectedReturnType, int);
154 expect(opPlusMirror.reflectedReturnType, int); 155 expect(opPlusMirror.reflectedReturnType, int);
155 expect(opBracketMirror.reflectedReturnType, int); 156 expect(opBracketMirror.reflectedReturnType, int);
156 expect(opBracketEqualsMirror.hasReflectedReturnType, false); 157 expect(opBracketEqualsMirror.hasReflectedReturnType, false);
157 expect(getsetMirror.reflectedReturnType, String); 158 expect(getsetMirror.reflectedReturnType, String);
158 expect(getsetEqualsMirror.hasReflectedReturnType, false); 159 expect(getsetEqualsMirror.hasReflectedReturnType, false);
159 expect(noArgumentsMirror.reflectedReturnType, int); 160 expect(noArgumentsMirror.reflectedReturnType, int);
160 expect(oneArgumentMirror.reflectedReturnType, int); 161 expect(oneArgumentMirror.reflectedReturnType, int);
161 expect(optionalArgumentsMirror.reflectedReturnType, int); 162 expect(optionalArgumentsMirror.reflectedReturnType, int);
162 expect(namedArgumentsMirror.reflectedReturnType, int); 163 expect(namedArgumentsMirror.reflectedReturnType, int);
163 expect(staticGetsetMirror.reflectedReturnType, List); 164 expect(staticGetsetMirror.reflectedReturnType,
165 const TypeValue<List<String>>().type);
164 expect(staticGetsetEqualsMirror.hasReflectedReturnType, false); 166 expect(staticGetsetEqualsMirror.hasReflectedReturnType, false);
165 }); 167 });
166 } 168 }
OLDNEW
« no previous file with comments | « test_reflectable/test/new_instance_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698