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

Side by Side Diff: tests/lib_strong/mirrors/inherited_metadata_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.mirrors; 5 library test.mirrors;
6 6
7 @MirrorsUsed(targets: "test.mirrors") 7 @MirrorsUsed(targets: "test.mirrors")
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 9
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
11 11
12
13 class RemoteClass { 12 class RemoteClass {
14 final String name; 13 final String name;
15 const RemoteClass([this.name]); 14 const RemoteClass([this.name]);
16 } 15 }
17 16
18 class A { 17 class A {}
19 }
20 18
21 @RemoteClass("ASF") 19 @RemoteClass("ASF")
22 class B extends A { 20 class B extends A {}
23 }
24 21
25 class C extends B { 22 class C extends B {}
26 }
27
28 23
29 void main() { 24 void main() {
30 bool foundB = false; 25 bool foundB = false;
31 26
32 MirrorSystem mirrorSystem = currentMirrorSystem(); 27 MirrorSystem mirrorSystem = currentMirrorSystem();
33 mirrorSystem.libraries.forEach((lk, l) { 28 mirrorSystem.libraries.forEach((lk, l) {
34 l.declarations.forEach((dk, d) { 29 l.declarations.forEach((dk, d) {
35 if(d is ClassMirror) { 30 if (d is ClassMirror) {
36 d.metadata.forEach((md) { 31 d.metadata.forEach((md) {
37 InstanceMirror metadata = md as InstanceMirror; 32 InstanceMirror metadata = md as InstanceMirror;
38 // Metadata must not be inherited. 33 // Metadata must not be inherited.
39 if(metadata.type == reflectClass(RemoteClass)) { 34 if (metadata.type == reflectClass(RemoteClass)) {
40 Expect.isFalse(foundB); 35 Expect.isFalse(foundB);
41 Expect.equals(#B, d.simpleName); 36 Expect.equals(#B, d.simpleName);
42 foundB = true; 37 foundB = true;
43 } 38 }
44 }); 39 });
45 } 40 }
46 }); 41 });
47 }); 42 });
48 43
49 Expect.isTrue(foundB); 44 Expect.isTrue(foundB);
50 } 45 }
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698