| OLD | NEW |
| 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 /** | 5 /** |
| 6 * A library for writing dart unit tests. | 6 * A library for writing dart unit tests. |
| 7 * | 7 * |
| 8 * ## Installing ## | 8 * ## Installing ## |
| 9 * | 9 * |
| 10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` | 10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 (_currentTestCaseIndex >= 0 && _currentTestCaseIndex < testCases.length) | 293 (_currentTestCaseIndex >= 0 && _currentTestCaseIndex < testCases.length) |
| 294 ? testCases[_currentTestCaseIndex] | 294 ? testCases[_currentTestCaseIndex] |
| 295 : null; | 295 : null; |
| 296 | 296 |
| 297 /** Whether the framework is in an initialized state. */ | 297 /** Whether the framework is in an initialized state. */ |
| 298 bool _initialized = false; | 298 bool _initialized = false; |
| 299 | 299 |
| 300 String _uncaughtErrorMessage = null; | 300 String _uncaughtErrorMessage = null; |
| 301 | 301 |
| 302 /** Time since we last gave non-sync code a chance to be scheduled. */ | 302 /** Time since we last gave non-sync code a chance to be scheduled. */ |
| 303 int _lastBreath = new DateTime.now().millisecondsSinceEpoch; | 303 var _lastBreath = new DateTime.now().millisecondsSinceEpoch; |
| 304 | 304 |
| 305 /** Test case result strings. */ | 305 /** Test case result strings. */ |
| 306 // TODO(gram) we should change these constants to use a different string | 306 // TODO(gram) we should change these constants to use a different string |
| 307 // (so that writing 'FAIL' in the middle of a test doesn't | 307 // (so that writing 'FAIL' in the middle of a test doesn't |
| 308 // imply that the test fails). We can't do it without also changing | 308 // imply that the test fails). We can't do it without also changing |
| 309 // the testrunner and test.dart though. | 309 // the testrunner and test.dart though. |
| 310 const PASS = 'pass'; | 310 const PASS = 'pass'; |
| 311 const FAIL = 'fail'; | 311 const FAIL = 'fail'; |
| 312 const ERROR = 'error'; | 312 const ERROR = 'error'; |
| 313 | 313 |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 865 |
| 866 if (!formatStacks) return trace; | 866 if (!formatStacks) return trace; |
| 867 | 867 |
| 868 // Format the stack trace by removing everything above TestCase._runTest, | 868 // Format the stack trace by removing everything above TestCase._runTest, |
| 869 // which is usually going to be irrelevant. Also fold together unittest and | 869 // which is usually going to be irrelevant. Also fold together unittest and |
| 870 // core library calls so only the function the user called is visible. | 870 // core library calls so only the function the user called is visible. |
| 871 return new Trace(trace.frames.takeWhile((frame) { | 871 return new Trace(trace.frames.takeWhile((frame) { |
| 872 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; | 872 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; |
| 873 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); | 873 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); |
| 874 } | 874 } |
| OLD | NEW |