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

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

Issue 24631003: Add proper API for creating private symbols wrt a library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: amend tests Created 7 years, 2 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 | 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 import 'package:expect/expect.dart'; 6 import 'package:expect/expect.dart';
7 import 'stringify.dart'; 7 import 'stringify.dart';
8 8
9 bool isDart2js = false;
10
9 testIntercepted() { 11 testIntercepted() {
10 var instance = []; 12 var instance = [];
11 var methodMirror = reflect(instance.toString); 13 var closureMirror = reflect(instance.toString);
12 String rest = ' in s(List)'; 14 var methodMirror = closureMirror.function;
13 rest = ''; /// 01: ok 15 Expect.equals(#toString, methodMirror.simpleName);
14 expect('Method(s(toString)$rest)', methodMirror.function); 16 Expect.equals('[]', closureMirror.apply([]).reflectee);
15 Expect.equals('[]', methodMirror.apply([]).reflectee);
16 } 17 }
17 18
18 testNonIntercepted() { 19 testNonIntercepted() {
19 var closure = new Map().containsKey; 20 var closure = new Map().containsKey;
20 var mirror = reflect(closure); 21 var closureMirror = reflect(closure);
21 String rest = ' in s(_HashMap)'; // Might become Map instead. 22 var methodMirror = closureMirror.function;
rmacnak 2013/09/27 01:38:27 Testing the function's owner is bogus because the
22 rest = ''; /// 01: ok 23 Expect.equals(#containsKey, methodMirror.simpleName);
23 expect('Method(s(containsKey)$rest)', mirror.function); 24 Expect.isFalse(closureMirror.apply([7]).reflectee);
24 Expect.isFalse(mirror.apply([7]).reflectee);
25 } 25 }
26 26
27 main() { 27 main() {
28 testIntercepted(); 28 testIntercepted();
29 testNonIntercepted(); 29 testNonIntercepted();
30 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698