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

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

Issue 20458002: Wrap lazy compilation errors when parsing metadata. Addresses the poor error reporting in issue 120… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | « runtime/lib/mirrors.cc ('k') | no next file » | 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 // VMOptions=--enable_type_checks 8 // VMOptions=--enable_type_checks
9 9
10 library isolate_mirror_local_test; 10 library isolate_mirror_local_test;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 Expect.equals("InstanceMirror on null", mirror.toString()); 400 Expect.equals("InstanceMirror on null", mirror.toString());
401 testDone('testNullInstanceMirror'); 401 testDone('testNullInstanceMirror');
402 } 402 }
403 403
404 class MySuperClass { 404 class MySuperClass {
405 } 405 }
406 406
407 class MyInterface { 407 class MyInterface {
408 } 408 }
409 409
410 @notDefined
410 class MyClass extends MySuperClass implements MyInterface { 411 class MyClass extends MySuperClass implements MyInterface {
411 MyClass(this.value) {} 412 MyClass(this.value) {}
412 MyClass.named() {} 413 MyClass.named() {}
413 414
414 final value; 415 final value;
415 416
416 int method(int arg) { 417 int method(int arg) {
417 return arg + value; 418 return arg + value;
418 } 419 }
419 } 420 }
(...skipping 18 matching lines...) Expand all
438 // mirror.toString()); 439 // mirror.toString());
439 440
440 ClassMirror cls = mirror.type; 441 ClassMirror cls = mirror.type;
441 Expect.isTrue(cls is ClassMirror); 442 Expect.isTrue(cls is ClassMirror);
442 Expect.equals(const Symbol('MyClass'), cls.simpleName); 443 Expect.equals(const Symbol('MyClass'), cls.simpleName);
443 Expect.equals(const Symbol('MySuperClass'), cls.superclass.simpleName); 444 Expect.equals(const Symbol('MySuperClass'), cls.superclass.simpleName);
444 Expect.isTrue(cls.defaultFactory == null); 445 Expect.isTrue(cls.defaultFactory == null);
445 Expect.equals(const Symbol('isolate_mirror_local_test'), cls.owner.simpleName) ; 446 Expect.equals(const Symbol('isolate_mirror_local_test'), cls.owner.simpleName) ;
446 Expect.isTrue(cls.isClass); 447 Expect.isTrue(cls.isClass);
447 Expect.equals(const Symbol('MyInterface'), cls.superinterfaces[0].simpleName); 448 Expect.equals(const Symbol('MyInterface'), cls.superinterfaces[0].simpleName);
449 Expect.throws(() => cls.metadata, (e) => e is MirroredCompilationError, 'Bad m etadata');
ahe 2013/07/26 10:13:03 Long line.
448 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque. 450 // TODO(ahe): toString() test disabled for now as Symbols are 100% opaque.
449 // Expect.equals("ClassMirror on 'MyClass'", cls.toString()); 451 // Expect.equals("ClassMirror on 'MyClass'", cls.toString());
ahe 2013/07/26 10:13:03 I think you can enable this again.
450 452
451 // Invoke mirror.method(1000). 453 // Invoke mirror.method(1000).
452 mirror.invokeAsync(const Symbol('method'), [ 1000 ]).then( 454 mirror.invokeAsync(const Symbol('method'), [ 1000 ]).then(
453 (InstanceMirror retval) { 455 (InstanceMirror retval) {
454 Expect.equals(const Symbol('int'), retval.type.simpleName); 456 Expect.equals(const Symbol('int'), retval.type.simpleName);
455 Expect.isTrue(retval.hasReflectee); 457 Expect.isTrue(retval.hasReflectee);
456 Expect.equals(1017, retval.reflectee); 458 Expect.equals(1017, retval.reflectee);
457 testDone('testCustomInstanceMirror'); 459 testDone('testCustomInstanceMirror');
458 }); 460 });
459 461
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // Test that an isolate can reflect on itself. 537 // Test that an isolate can reflect on itself.
536 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem); 538 mirrorSystemOf(exit_port.toSendPort()).then(testMirrorSystem);
537 539
538 testIntegerInstanceMirror(reflect(1001)); 540 testIntegerInstanceMirror(reflect(1001));
539 testStringInstanceMirror(reflect('This\nis\na\nString')); 541 testStringInstanceMirror(reflect('This\nis\na\nString'));
540 testBoolInstanceMirror(reflect(true)); 542 testBoolInstanceMirror(reflect(true));
541 testNullInstanceMirror(reflect(null)); 543 testNullInstanceMirror(reflect(null));
542 testCustomInstanceMirror(reflect(new MyClass(17))); 544 testCustomInstanceMirror(reflect(new MyClass(17)));
543 testMirrorErrors(currentMirrorSystem()); 545 testMirrorErrors(currentMirrorSystem());
544 } 546 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698