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

Side by Side Diff: dart/tests/lib/mirrors/reflect_model_test.dart

Issue 17601005: Implement JsClassMirror.constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on CL 17601006 to fix issues in minified mode. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « dart/tests/lib/mirrors/constructors_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) 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.reflect_model_test; 5 library test.reflect_model_test;
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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (variable.isFinal) buffer.write(', final'); 48 if (variable.isFinal) buffer.write(', final');
49 return (buffer..write(')')).toString(); 49 return (buffer..write(')')).toString();
50 } 50 }
51 51
52 stringifyMethod(MethodMirror method) { 52 stringifyMethod(MethodMirror method) {
53 var buffer = new StringBuffer('Method('); 53 var buffer = new StringBuffer('Method(');
54 writeDeclarationOn(method, buffer); 54 writeDeclarationOn(method, buffer);
55 if (method.isStatic) buffer.write(', static'); 55 if (method.isStatic) buffer.write(', static');
56 if (method.isGetter) buffer.write(', getter'); 56 if (method.isGetter) buffer.write(', getter');
57 if (method.isSetter) buffer.write(', setter'); 57 if (method.isSetter) buffer.write(', setter');
58 if (method.isConstructor) buffer.write(', constructor');
58 return (buffer..write(')')).toString(); 59 return (buffer..write(')')).toString();
59 } 60 }
60 61
61 stringify(value) { 62 stringify(value) {
62 if (value is Map) return stringifyMap(value); 63 if (value is Map) return stringifyMap(value);
63 if (value is VariableMirror) return stringifyVariable(value); 64 if (value is VariableMirror) return stringifyVariable(value);
64 if (value is MethodMirror) return stringifyMethod(value); 65 if (value is MethodMirror) return stringifyMethod(value);
65 if (value is Symbol) return stringifySymbol(value); 66 if (value is Symbol) return stringifySymbol(value);
66 if (value == null) return '<null>'; 67 if (value == null) return '<null>';
67 throw 'Unexpected value: $value'; 68 throw 'Unexpected value: $value';
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Expect.equals('aMethod', c.invoke(aMethod, []).reflectee); 161 Expect.equals('aMethod', c.invoke(aMethod, []).reflectee);
161 162
162 Expect.throws(() { a.invoke(bMethod, []); }, isNoSuchMethodError); 163 Expect.throws(() { a.invoke(bMethod, []); }, isNoSuchMethodError);
163 Expect.equals('bMethod', b.invoke(bMethod, []).reflectee); 164 Expect.equals('bMethod', b.invoke(bMethod, []).reflectee);
164 Expect.equals('bMethod', c.invoke(bMethod, []).reflectee); 165 Expect.equals('bMethod', c.invoke(bMethod, []).reflectee);
165 166
166 Expect.throws(() { a.invoke(cMethod, []); }, isNoSuchMethodError); 167 Expect.throws(() { a.invoke(cMethod, []); }, isNoSuchMethodError);
167 Expect.throws(() { b.invoke(cMethod, []); }, isNoSuchMethodError); 168 Expect.throws(() { b.invoke(cMethod, []); }, isNoSuchMethodError);
168 Expect.equals('cMethod', c.invoke(cMethod, []).reflectee); 169 Expect.equals('cMethod', c.invoke(cMethod, []).reflectee);
169 } 170 }
OLDNEW
« no previous file with comments | « dart/tests/lib/mirrors/constructors_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698