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

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

Issue 2770063002: Revert "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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
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.constructor_kinds_test; 5 library test.constructor_kinds_test;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 class ClassWithDefaultConstructor {} 10 class ClassWithDefaultConstructor {}
11 11
12 class Class { 12 class Class {
13 Class.generativeConstructor(); 13 Class.generativeConstructor();
14 Class.redirectingGenerativeConstructor() : this.generativeConstructor(); 14 Class.redirectingGenerativeConstructor() : this.generativeConstructor();
15 factory Class.factoryConstructor() => new Class.generativeConstructor(); 15 factory Class.factoryConstructor() => new Class.generativeConstructor();
16 factory Class.redirectingFactoryConstructor() = Class.factoryConstructor; 16 factory Class.redirectingFactoryConstructor() = Class.factoryConstructor;
17 17
18 const Class.constGenerativeConstructor(); 18 const Class.constGenerativeConstructor();
19 const Class.constRedirectingGenerativeConstructor() 19 const Class.constRedirectingGenerativeConstructor()
20 : this.constGenerativeConstructor(); 20 : this.constGenerativeConstructor();
21 // Not legal. 21 // Not legal.
22 // const factory Class.constFactoryConstructor() => ... 22 // const factory Class.constFactoryConstructor() => ...
23 const factory Class.constRedirectingFactoryConstructor() = 23 const factory Class.constRedirectingFactoryConstructor()
24 Class.constGenerativeConstructor; 24 = Class.constGenerativeConstructor;
25 } 25 }
26 26
27 main() { 27 main() {
28 ClassMirror cm; 28 ClassMirror cm;
29 MethodMirror mm; 29 MethodMirror mm;
30 30
31 // Multitest with and without constructor calls. On the VM, we want to check 31 // Multitest with and without constructor calls. On the VM, we want to check
32 // that constructor properties are correctly set even if the constructor 32 // that constructor properties are correctly set even if the constructor
33 // hasn't been fully compiled. On dart2js, we want to check that constructors 33 // hasn't been fully compiled. On dart2js, we want to check that constructors
34 // are retain even if there are no base-level calls. 34 // are retain even if there are no base-level calls.
35 new ClassWithDefaultConstructor(); // //# 01: ok 35 new ClassWithDefaultConstructor(); // //# 01: ok
36 new Class.generativeConstructor(); // //# 01: ok 36 new Class.generativeConstructor(); // //# 01: ok
37 new Class.redirectingGenerativeConstructor(); // //# 01: ok 37 new Class.redirectingGenerativeConstructor(); // //# 01: ok
38 new Class.factoryConstructor(); // //# 01: ok 38 new Class.factoryConstructor(); // //# 01: ok
39 new Class.redirectingFactoryConstructor(); // //# 01: ok 39 new Class.redirectingFactoryConstructor(); // //# 01: ok
40 const Class.constGenerativeConstructor(); // //# 01: ok 40 const Class.constGenerativeConstructor(); // //# 01: ok
41 const Class.constRedirectingGenerativeConstructor(); // //# 01: ok 41 const Class.constRedirectingGenerativeConstructor(); // //# 01: ok
42 const Class.constRedirectingFactoryConstructor(); // //# 01: ok 42 const Class.constRedirectingFactoryConstructor(); // //# 01: ok
43 43
44 cm = reflectClass(ClassWithDefaultConstructor); 44 cm = reflectClass(ClassWithDefaultConstructor);
45 mm = cm.declarations.values 45 mm = cm.declarations.values
46 .where((d) => d is MethodMirror && d.isConstructor) 46 .where((d) => d is MethodMirror && d.isConstructor).single;
47 .single;
48 Expect.isTrue(mm.isConstructor); 47 Expect.isTrue(mm.isConstructor);
49 Expect.isTrue(mm.isGenerativeConstructor); 48 Expect.isTrue(mm.isGenerativeConstructor);
50 Expect.isFalse(mm.isFactoryConstructor); 49 Expect.isFalse(mm.isFactoryConstructor);
51 Expect.isFalse(mm.isRedirectingConstructor); 50 Expect.isFalse(mm.isRedirectingConstructor);
52 Expect.isFalse(mm.isConstConstructor); 51 Expect.isFalse(mm.isConstConstructor);
53 52
54 cm = reflectClass(Class); 53 cm = reflectClass(Class);
55 54
56 mm = cm.declarations[#Class.generativeConstructor]; 55 mm = cm.declarations[#Class.generativeConstructor];
57 Expect.isTrue(mm.isConstructor); 56 Expect.isTrue(mm.isConstructor);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Expect.isFalse(mm.isRedirectingConstructor); 102 // Expect.isFalse(mm.isRedirectingConstructor);
104 // Expect.isTrue(mm.isConstConstructor); 103 // Expect.isTrue(mm.isConstConstructor);
105 104
106 mm = cm.declarations[#Class.constRedirectingFactoryConstructor]; 105 mm = cm.declarations[#Class.constRedirectingFactoryConstructor];
107 Expect.isTrue(mm.isConstructor); 106 Expect.isTrue(mm.isConstructor);
108 Expect.isFalse(mm.isGenerativeConstructor); 107 Expect.isFalse(mm.isGenerativeConstructor);
109 Expect.isTrue(mm.isFactoryConstructor); 108 Expect.isTrue(mm.isFactoryConstructor);
110 Expect.isTrue(mm.isRedirectingConstructor); 109 Expect.isTrue(mm.isRedirectingConstructor);
111 Expect.isTrue(mm.isConstConstructor); 110 Expect.isTrue(mm.isConstConstructor);
112 } 111 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/class_declarations_test.dart ('k') | tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698