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

Side by Side Diff: utils/tests/pub/test_pub.dart

Issue 10766005: Allow asynchronous tests to explicitly register exceptions along with stack traces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « lib/unittest/unittest.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) 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 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 final future = _setUpSandbox().chain((sandboxDir) { 176 final future = _setUpSandbox().chain((sandboxDir) {
177 createdSandboxDir = sandboxDir; 177 createdSandboxDir = sandboxDir;
178 return _runScheduled(sandboxDir, _scheduled); 178 return _runScheduled(sandboxDir, _scheduled);
179 }); 179 });
180 180
181 future.handleException((error) { 181 future.handleException((error) {
182 // If an error occurs during testing, delete the sandbox, throw the error so 182 // If an error occurs during testing, delete the sandbox, throw the error so
183 // that the test framework sees it, then finally call asyncDone so that the 183 // that the test framework sees it, then finally call asyncDone so that the
184 // test framework knows we're done doing asynchronous stuff. 184 // test framework knows we're done doing asynchronous stuff.
185 cleanup().then((_) { 185 cleanup().then((_) {
186 guardAsync(() { throw error; }, asyncDone); 186 registerException(error, future.stackTrace);
187 asyncDone();
187 }); 188 });
188 return true; 189 return true;
189 }); 190 });
190 191
191 future.chain((_) => cleanup()).then((_) => asyncDone()); 192 future.chain((_) => cleanup()).then((_) => asyncDone());
192 } 193 }
193 194
194 /** 195 /**
195 * Schedules a call to the Pub command-line utility. Runs Pub with [args] and 196 * Schedules a call to the Pub command-line utility. Runs Pub with [args] and
196 * validates that its results match [output], [error], and [exitCode]. 197 * validates that its results match [output], [error], and [exitCode].
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 718 }
718 719
719 /** 720 /**
720 * Schedules a callback to be called after Pub is run with [runPub], even if it 721 * Schedules a callback to be called after Pub is run with [runPub], even if it
721 * fails. 722 * fails.
722 */ 723 */
723 void _scheduleCleanup(_ScheduledEvent event) { 724 void _scheduleCleanup(_ScheduledEvent event) {
724 if (_scheduledCleanup == null) _scheduledCleanup = []; 725 if (_scheduledCleanup == null) _scheduledCleanup = [];
725 _scheduledCleanup.add(event); 726 _scheduledCleanup.add(event);
726 } 727 }
OLDNEW
« no previous file with comments | « lib/unittest/unittest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698