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

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

Issue 18052004: Implement JsMethodMirror.parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Test of [ParameterMirror].
6 library test.parameter_test;
7
8 @MirrorsUsed(targets: 'test.parameter_test', override: '*')
9 import 'dart:mirrors';
10
11 import 'stringify.dart';
12
13 class B {
14 B();
15 B.foo(int x);
16 B.bar(int z, x);
17 }
18
19 main() {
20 var constructors = reflectClass(B).constructors;
21
22 expect('{B: Method(s(B) in s(B), constructor), '
23 'B.bar: Method(s(B.bar) in s(B), constructor), '
24 'B.foo: Method(s(B.foo) in s(B), constructor)}',
25 constructors);
26
27 var unnamedConstructor = constructors[new Symbol('B')];
28
29 expect('[]', unnamedConstructor.parameters);
30 expect('Type(s(B) in s(test.parameter_test), top-level)',
31 unnamedConstructor.returnType);
32
33 var fooConstructor = constructors[new Symbol('B.foo')];
34 expect('[Parameter(s(x) in s(B.foo),'
35 ' type = Type(s(int) in s(dart.core), top-level))]',
36 fooConstructor.parameters);
37 expect('Type(s(B) in s(test.parameter_test), top-level)',
38 fooConstructor.returnType);
39
40 var barConstructor = constructors[new Symbol('B.bar')];
41 expect('[Parameter(s(z) in s(B.bar),'
42 ' type = Type(s(int) in s(dart.core), top-level)), '
43 'Parameter(s(x) in s(B.bar),'
44 ' type = Type(s(dynamic), top-level))]',
45 barConstructor.parameters);
46 expect('Type(s(B) in s(test.parameter_test), top-level)',
47 barConstructor.returnType);
48
49 print(constructors);
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698