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

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

Issue 1632163004: Use existing test for reflectClass(List).createInstance(...) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « tests/lib/mirrors/constructor_list_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.constructor_test; 5 library test.constructor_test;
6 6
7 @MirrorsUsed(targets: const [A]) 7 @MirrorsUsed(targets: const [A])
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 10
11 class A { 11 class A {
12 factory A([x, y]) = B; 12 factory A([x, y]) = B;
13 factory A.more([x, y]) = B.more; 13 factory A.more([x, y]) = B.more;
14 factory A.oneMore(x, [y]) = B.more; 14 factory A.oneMore(x, [y]) = B.more;
15 } 15 }
16 16
17 class B implements A { 17 class B implements A {
18 final _x, _y, _z; 18 final _x, _y, _z;
19 19
20 B([x = 'x', y = 'y']) : _x = x, _y = y; 20 B([x = 'x', y = 'y']) : _x = x, _y = y, _z = null;
21 21
22 B.more([x = 'x', y = 'y', z = 'z']) : _x = x, _y = y, _z = z; 22 B.more([x = 'x', y = 'y', z = 'z']) : _x = x, _y = y, _z = z;
23 23
24 toString() => 'B(x=$_x, y=$_y, z=$_z)'; 24 toString() => 'B(x=$_x, y=$_y, z=$_z)';
25 } 25 }
26 26
27 27
28 main() { 28 main() {
29 var d1 = new A(1); 29 var d1 = new A(1);
30 Expect.equals('B(x=1, y=y, z=null)', '$d1', 'direct 1'); 30 Expect.equals('B(x=1, y=y, z=null)', '$d1', 'direct 1');
(...skipping 18 matching lines...) Expand all
49 Expect.equals('B(x=x, y=y, z=z)', '$m1', 'more 1'); 49 Expect.equals('B(x=x, y=y, z=z)', '$m1', 'more 1');
50 Expect.equals('B(x=1, y=y, z=z)', '$m2', 'more 2'); 50 Expect.equals('B(x=1, y=y, z=z)', '$m2', 'more 2');
51 Expect.equals('B(x=2, y=3, z=z)', '$m3', 'more 3'); 51 Expect.equals('B(x=2, y=3, z=z)', '$m3', 'more 3');
52 52
53 var o1 = cm.newInstance(const Symbol('oneMore'), [1]).reflectee; 53 var o1 = cm.newInstance(const Symbol('oneMore'), [1]).reflectee;
54 var o2 = cm.newInstance(const Symbol('oneMore'), [2, 3]).reflectee; 54 var o2 = cm.newInstance(const Symbol('oneMore'), [2, 3]).reflectee;
55 55
56 Expect.equals('B(x=1, y=y, z=z)', '$o1', 'oneMore one arg'); 56 Expect.equals('B(x=1, y=y, z=z)', '$o1', 'oneMore one arg');
57 Expect.equals('B(x=2, y=3, z=z)', '$o2', 'oneMore two args'); 57 Expect.equals('B(x=2, y=3, z=z)', '$o2', 'oneMore two args');
58 } 58 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/constructor_list_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698