| OLD | NEW |
| 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 /// Test of [ParameterMirror]. | 5 // This tests uses the multi-test "ok" feature: |
| 6 // none: Desired behaviour, passing on the VM. |
| 7 // 01: Trimmed version for dart2js. |
| 8 // |
| 9 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par. |
| 10 |
| 11 /** Test of [ParameterMirror]. */ |
| 6 library test.parameter_test; | 12 library test.parameter_test; |
| 7 | 13 |
| 8 @MirrorsUsed(targets: 'test.parameter_test', override: '*') | 14 @MirrorsUsed(targets: 'test.parameter_test', override: '*') |
| 9 import 'dart:mirrors'; | 15 import 'dart:mirrors'; |
| 10 | 16 |
| 11 import 'package:expect/expect.dart'; | 17 import 'package:expect/expect.dart'; |
| 12 import 'stringify.dart'; | 18 import 'stringify.dart'; |
| 13 | 19 |
| 14 class B { | 20 class B { |
| 15 B(); | 21 B(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 MethodMirror barConstructor = constructors[const Symbol('B.bar')]; | 64 MethodMirror barConstructor = constructors[const Symbol('B.bar')]; |
| 59 expect('Method(s(B.bar) in s(B), constructor)', barConstructor); | 65 expect('Method(s(B.bar) in s(B), constructor)', barConstructor); |
| 60 expect('[Parameter(s(z) in s(B.bar),' | 66 expect('[Parameter(s(z) in s(B.bar),' |
| 61 ' type = Class(s(int) in s(dart.core), top-level)), ' | 67 ' type = Class(s(int) in s(dart.core), top-level)), ' |
| 62 'Parameter(s(x) in s(B.bar),' | 68 'Parameter(s(x) in s(B.bar),' |
| 63 ' type = Type(s(dynamic), top-level))]', | 69 ' type = Type(s(dynamic), top-level))]', |
| 64 barConstructor.parameters); | 70 barConstructor.parameters); |
| 65 expect('Class(s(B) in s(test.parameter_test), top-level)', | 71 expect('Class(s(B) in s(test.parameter_test), top-level)', |
| 66 barConstructor.returnType); | 72 barConstructor.returnType); |
| 67 | 73 |
| 74 // dart2js stops testing here. |
| 75 return; /// 01: ok |
| 76 |
| 68 MethodMirror bazConstructor = constructors[const Symbol('B.baz')]; | 77 MethodMirror bazConstructor = constructors[const Symbol('B.baz')]; |
| 69 expect('Method(s(B.baz) in s(B), constructor)', bazConstructor); | 78 expect('Method(s(B.baz) in s(B), constructor)', bazConstructor); |
| 70 expect('[Parameter(s(x) in s(B.baz), final,' | 79 expect('[Parameter(s(x) in s(B.baz), final,' |
| 71 ' type = Class(s(int) in s(dart.core), top-level)), ' | 80 ' type = Class(s(int) in s(dart.core), top-level)), ' |
| 72 'Parameter(s(y) in s(B.baz),' | 81 'Parameter(s(y) in s(B.baz),' |
| 73 ' type = Class(s(int) in s(dart.core), top-level)), ' | 82 ' type = Class(s(int) in s(dart.core), top-level)), ' |
| 74 'Parameter(s(z) in s(B.baz), final,' | 83 'Parameter(s(z) in s(B.baz), final,' |
| 75 ' type = Class(s(int) in s(dart.core), top-level))]', | 84 ' type = Class(s(int) in s(dart.core), top-level))]', |
| 76 bazConstructor.parameters); | 85 bazConstructor.parameters); |
| 77 expect('Class(s(B) in s(test.parameter_test), top-level)', | 86 expect('Class(s(B) in s(test.parameter_test), top-level)', |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 garply.parameters); | 144 garply.parameters); |
| 136 expect('Instance(value = <null>)', garply.parameters[0].defaultValue); | 145 expect('Instance(value = <null>)', garply.parameters[0].defaultValue); |
| 137 | 146 |
| 138 MethodMirror waldo = cm.members[const Symbol("waldo")]; | 147 MethodMirror waldo = cm.members[const Symbol("waldo")]; |
| 139 expect('Method(s(waldo) in s(B))', waldo); | 148 expect('Method(s(waldo) in s(B))', waldo); |
| 140 expect('[Parameter(s(z) in s(waldo),' | 149 expect('[Parameter(s(z) in s(waldo),' |
| 141 ' type = Class(s(int) in s(dart.core), top-level))]', | 150 ' type = Class(s(int) in s(dart.core), top-level))]', |
| 142 waldo.parameters); | 151 waldo.parameters); |
| 143 expect('<null>', waldo.parameters[0].defaultValue); | 152 expect('<null>', waldo.parameters[0].defaultValue); |
| 144 } | 153 } |
| OLD | NEW |