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

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

Issue 49083004: Re-triage mirror test failures on the analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
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 import "dart:mirrors"; 5 import "dart:mirrors";
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 expectSource(Mirror mirror, String source) { 9 expectSource(Mirror mirror, String source) {
10 MethodMirror methodMirror;
10 if (mirror is ClosureMirror) { 11 if (mirror is ClosureMirror) {
11 mirror = mirror.function; 12 methodMirror = mirror.function;
13 } else {
14 methodMirror = mirror as MethodMirror;
12 } 15 }
13 Expect.isTrue(mirror is MethodMirror); 16 Expect.isTrue(methodMirror is MethodMirror);
14 Expect.equals(mirror.source, source); 17 Expect.equals(methodMirror.source, source);
15 } 18 }
16 19
17 foo1() {} 20 foo1() {}
18 doSomething(e) => e; 21 doSomething(e) => e;
19 22
20 int get x => 42; 23 int get x => 42;
21 set x(value) { } 24 set x(value) { }
22 25
23 class S {} 26 class S {}
24 27
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Closures 92 // Closures
90 expectSource(reflect((){}), "(){}"); 93 expectSource(reflect((){}), "(){}");
91 expectSource(reflect((x,y,z) { return x*y*z; }), "(x,y,z) { return x*y*z; }"); 94 expectSource(reflect((x,y,z) { return x*y*z; }), "(x,y,z) { return x*y*z; }");
92 expectSource(reflect((e) => doSomething(e)), "(e) => doSomething(e)"); 95 expectSource(reflect((e) => doSomething(e)), "(e) => doSomething(e)");
93 96
94 namedClosure(x,y,z) => 1; 97 namedClosure(x,y,z) => 1;
95 var a = () {}; 98 var a = () {};
96 expectSource(reflect(namedClosure), "namedClosure(x,y,z) => 1;"); 99 expectSource(reflect(namedClosure), "namedClosure(x,y,z) => 1;");
97 expectSource(reflect(a), "() {}"); 100 expectSource(reflect(a), "() {}");
98 } 101 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/method_mirror_returntype_test.dart ('k') | tests/lib/mirrors/mixin_members_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698