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

Side by Side Diff: tests/vm/dart/isolate_mirror_local_test.dart

Issue 10826191: Improve the stack trace output to be more readable. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « platform/assert.cc ('k') | vm/dart_api_impl.cc » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Dart test program for checking implemention of MirrorSystem when 5 // Dart test program for checking implemention of MirrorSystem when
6 // inspecting the current isolate. 6 // inspecting the current isolate.
7 7
8 #library('isolate_mirror_local_test'); 8 #library('isolate_mirror_local_test');
9 9
10 #import('dart:isolate'); 10 #import('dart:isolate');
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 Expect.equals('isolate_mirror_local_test', lib_mirror.simpleName); 93 Expect.equals('isolate_mirror_local_test', lib_mirror.simpleName);
94 Expect.isTrue(lib_mirror.url.contains('isolate_mirror_local_test.dart')); 94 Expect.isTrue(lib_mirror.url.contains('isolate_mirror_local_test.dart'));
95 Expect.equals("LibraryMirror on 'isolate_mirror_local_test'", 95 Expect.equals("LibraryMirror on 'isolate_mirror_local_test'",
96 lib_mirror.toString()); 96 lib_mirror.toString());
97 97
98 // Test library invocation by calling function(123). 98 // Test library invocation by calling function(123).
99 Expect.equals(0, global_var); 99 Expect.equals(0, global_var);
100 lib_mirror.invoke('function', [ 123 ]).then( 100 lib_mirror.invoke('function', [ 123 ]).then(
101 (InstanceMirror retval) { 101 (InstanceMirror retval) {
102 Expect.equals(123, global_var); 102 Expect.equals(123, global_var);
103 Expect.equals('Smi', retval.getClass().simpleName); 103 Expect.equals('int', retval.getClass().simpleName);
104 Expect.isTrue(retval.hasReflectee); 104 Expect.isTrue(retval.hasReflectee);
105 Expect.equals(124, retval.reflectee); 105 Expect.equals(124, retval.reflectee);
106 testDone('testRootLibraryMirror'); 106 testDone('testRootLibraryMirror');
107 }); 107 });
108 108
109 // Check that the members map is complete. 109 // Check that the members map is complete.
110 List keys = lib_mirror.members().getKeys(); 110 List keys = lib_mirror.members().getKeys();
111 sort(keys); 111 sort(keys);
112 Expect.equals('[' 112 Expect.equals('['
113 'MyClass, ' 113 'MyClass, '
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 259
260 void testMirrorSystem(MirrorSystem mirrors) { 260 void testMirrorSystem(MirrorSystem mirrors) {
261 Expect.isTrue(mirrors.isolate.debugName.contains('main')); 261 Expect.isTrue(mirrors.isolate.debugName.contains('main'));
262 testRootLibraryMirror(mirrors.rootLibrary); 262 testRootLibraryMirror(mirrors.rootLibrary);
263 testLibrariesMap(mirrors.libraries()); 263 testLibrariesMap(mirrors.libraries());
264 testDone('testMirrorSystem'); 264 testDone('testMirrorSystem');
265 } 265 }
266 266
267 void testIntegerInstanceMirror(InstanceMirror mirror) { 267 void testIntegerInstanceMirror(InstanceMirror mirror) {
268 // TODO(turnidge): The mirrors api exposes internal vm 268 Expect.equals('int', mirror.getClass().simpleName);
269 // implementation class names. Is this okay?
270 Expect.equals('Smi', mirror.getClass().simpleName);
271 Expect.isTrue(mirror.hasReflectee); 269 Expect.isTrue(mirror.hasReflectee);
272 Expect.equals(1001, mirror.reflectee); 270 Expect.equals(1001, mirror.reflectee);
273 Expect.equals("InstanceMirror on <1001>", mirror.toString()); 271 Expect.equals("InstanceMirror on <1001>", mirror.toString());
274 272
275 // Invoke (mirror + mirror). 273 // Invoke (mirror + mirror).
276 mirror.invoke('+', [ mirror ]).then( 274 mirror.invoke('+', [ mirror ]).then(
277 (InstanceMirror retval) { 275 (InstanceMirror retval) {
278 Expect.equals('Smi', retval.getClass().simpleName); 276 Expect.equals('int', retval.getClass().simpleName);
279 Expect.isTrue(retval.hasReflectee); 277 Expect.isTrue(retval.hasReflectee);
280 Expect.equals(2002, retval.reflectee); 278 Expect.equals(2002, retval.reflectee);
281 testDone('testIntegerInstanceMirror'); 279 testDone('testIntegerInstanceMirror');
282 }); 280 });
283 } 281 }
284 282
285 void testStringInstanceMirror(InstanceMirror mirror) { 283 void testStringInstanceMirror(InstanceMirror mirror) {
286 // TODO(turnidge): The mirrors api exposes internal vm 284 Expect.equals('String', mirror.getClass().simpleName);
287 // implementation class names. Is this okay?
288 Expect.equals('OneByteString', mirror.getClass().simpleName);
289 Expect.isTrue(mirror.hasReflectee); 285 Expect.isTrue(mirror.hasReflectee);
290 Expect.equals('This\nis\na\nString', mirror.reflectee); 286 Expect.equals('This\nis\na\nString', mirror.reflectee);
291 Expect.equals("InstanceMirror on <'This\\nis\\na\\nString'>", 287 Expect.equals("InstanceMirror on <'This\\nis\\na\\nString'>",
292 mirror.toString()); 288 mirror.toString());
293 289
294 // Invoke mirror[0]. 290 // Invoke mirror[0].
295 mirror.invoke('[]', [ 0 ]).then( 291 mirror.invoke('[]', [ 0 ]).then(
296 (InstanceMirror retval) { 292 (InstanceMirror retval) {
297 Expect.equals('OneByteString', retval.getClass().simpleName); 293 Expect.equals('String', retval.getClass().simpleName);
298 Expect.isTrue(retval.hasReflectee); 294 Expect.isTrue(retval.hasReflectee);
299 Expect.equals('T', retval.reflectee); 295 Expect.equals('T', retval.reflectee);
300 testDone('testStringInstanceMirror'); 296 testDone('testStringInstanceMirror');
301 }); 297 });
302 } 298 }
303 299
304 void testBoolInstanceMirror(InstanceMirror mirror) { 300 void testBoolInstanceMirror(InstanceMirror mirror) {
305 Expect.equals('Bool', mirror.getClass().simpleName); 301 Expect.equals('bool', mirror.getClass().simpleName);
306 Expect.isTrue(mirror.hasReflectee); 302 Expect.isTrue(mirror.hasReflectee);
307 Expect.equals(true, mirror.reflectee); 303 Expect.equals(true, mirror.reflectee);
308 Expect.equals("InstanceMirror on <true>", mirror.toString()); 304 Expect.equals("InstanceMirror on <true>", mirror.toString());
309 testDone('testBoolInstanceMirror'); 305 testDone('testBoolInstanceMirror');
310 } 306 }
311 307
312 void testNullInstanceMirror(InstanceMirror mirror) { 308 void testNullInstanceMirror(InstanceMirror mirror) {
313 // TODO(turnidge): This is returning the wrong class. Fix it. 309 // TODO(turnidge): This is returning the wrong class. Fix it.
314 Expect.equals('Object', mirror.getClass().simpleName); 310 Expect.equals('Object', mirror.getClass().simpleName);
315 Expect.isTrue(mirror.hasReflectee); 311 Expect.isTrue(mirror.hasReflectee);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 Expect.isTrue(cls.defaultFactory() === null); 348 Expect.isTrue(cls.defaultFactory() === null);
353 Expect.equals('isolate_mirror_local_test', cls.library.simpleName); 349 Expect.equals('isolate_mirror_local_test', cls.library.simpleName);
354 Expect.isTrue(cls.isClass); 350 Expect.isTrue(cls.isClass);
355 Expect.equals('MyInterface', cls.superinterfaces()[0].simpleName); 351 Expect.equals('MyInterface', cls.superinterfaces()[0].simpleName);
356 Expect.equals("InterfaceMirror on 'MyClass'", 352 Expect.equals("InterfaceMirror on 'MyClass'",
357 cls.toString()); 353 cls.toString());
358 354
359 // Invoke mirror.method(1000). 355 // Invoke mirror.method(1000).
360 mirror.invoke('method', [ 1000 ]).then( 356 mirror.invoke('method', [ 1000 ]).then(
361 (InstanceMirror retval) { 357 (InstanceMirror retval) {
362 Expect.equals('Smi', retval.getClass().simpleName); 358 Expect.equals('int', retval.getClass().simpleName);
363 Expect.isTrue(retval.hasReflectee); 359 Expect.isTrue(retval.hasReflectee);
364 Expect.equals(1017, retval.reflectee); 360 Expect.equals(1017, retval.reflectee);
365 testDone('testCustomInstanceMirror'); 361 testDone('testCustomInstanceMirror');
366 }); 362 });
367 363
368 } 364 }
369 365
370 class MyException implements Exception { 366 class MyException implements Exception {
371 MyException(this._message); 367 MyException(this._message);
372 final String _message; 368 final String _message;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); 456 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem);
461 457
462 MirrorSystem mirrors = currentMirrorSystem(); 458 MirrorSystem mirrors = currentMirrorSystem();
463 testIntegerInstanceMirror(mirrors.mirrorOf(1001)); 459 testIntegerInstanceMirror(mirrors.mirrorOf(1001));
464 testStringInstanceMirror(mirrors.mirrorOf('This\nis\na\nString')); 460 testStringInstanceMirror(mirrors.mirrorOf('This\nis\na\nString'));
465 testBoolInstanceMirror(mirrors.mirrorOf(true)); 461 testBoolInstanceMirror(mirrors.mirrorOf(true));
466 testNullInstanceMirror(mirrors.mirrorOf(null)); 462 testNullInstanceMirror(mirrors.mirrorOf(null));
467 testCustomInstanceMirror(mirrors.mirrorOf(new MyClass(17))); 463 testCustomInstanceMirror(mirrors.mirrorOf(new MyClass(17)));
468 testMirrorErrors(currentMirrorSystem()); 464 testMirrorErrors(currentMirrorSystem());
469 } 465 }
OLDNEW
« no previous file with comments | « platform/assert.cc ('k') | vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698