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

Side by Side Diff: pkg/analysis_server/test/reflective_tests.dart

Issue 362793004: Update analysis.errors notification to the newest spec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « pkg/analysis_server/test/operation/operation_analysis_test.dart ('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) 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 reflective.tests; 5 library reflective.tests;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 @MirrorsUsed(metaTargets: 'ReflectiveTestCase') 9 @MirrorsUsed(metaTargets: 'ReflectiveTestCase')
10 import 'dart:mirrors'; 10 import 'dart:mirrors';
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // solo_test_ 56 // solo_test_
57 if (memberName.startsWith('solo_test_')) { 57 if (memberName.startsWith('solo_test_')) {
58 String testName = memberName.substring('solo_test_'.length); 58 String testName = memberName.substring('solo_test_'.length);
59 solo_test(testName, () { 59 solo_test(testName, () {
60 return _runTest(classMirror, symbol); 60 return _runTest(classMirror, symbol);
61 }); 61 });
62 } 62 }
63 }); 63 });
64 } 64 }
65 65
66
66 _runTest(ClassMirror classMirror, Symbol symbol) { 67 _runTest(ClassMirror classMirror, Symbol symbol) {
67 InstanceMirror instanceMirror = classMirror.newInstance(new Symbol(''), []); 68 InstanceMirror instanceMirror = classMirror.newInstance(new Symbol(''), []);
69 bool shouldRunTearDown = true;
68 _invokeSymbolIfExists(instanceMirror, #setUp); 70 _invokeSymbolIfExists(instanceMirror, #setUp);
69 var testReturn = instanceMirror.invoke(symbol, []).reflectee; 71 try {
70 if (testReturn is Future) { 72 var testReturn = instanceMirror.invoke(symbol, []).reflectee;
71 return testReturn.whenComplete(() { 73 if (testReturn is Future) {
72 _invokeSymbolIfExists(instanceMirror, #tearDown); 74 shouldRunTearDown = false;
73 }); 75 return testReturn.whenComplete(() {
74 } else { 76 _invokeTearDown(instanceMirror);
75 _invokeSymbolIfExists(instanceMirror, #tearDown); 77 });
76 return testReturn; 78 } else {
79 return testReturn;
80 }
81 } finally {
82 if (shouldRunTearDown) {
83 _invokeTearDown(instanceMirror);
84 }
77 } 85 }
78 } 86 }
79 87
80 88
89 void _invokeTearDown(InstanceMirror instanceMirror) {
90 _invokeSymbolIfExists(instanceMirror, #tearDown);
91 }
92
93
81 void _invokeSymbolIfExists(InstanceMirror instanceMirror, Symbol symbol) { 94 void _invokeSymbolIfExists(InstanceMirror instanceMirror, Symbol symbol) {
82 try { 95 try {
83 instanceMirror.invoke(symbol, []); 96 instanceMirror.invoke(symbol, []);
84 } on NoSuchMethodError catch (e) { 97 } on NoSuchMethodError catch (e) {
85 } 98 }
86 } 99 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/operation/operation_analysis_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698