Chromium Code Reviews| 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 * Support for writing Dart unit tests. | 6 * Support for writing Dart unit tests. |
| 7 * | 7 * |
| 8 * For information on installing and importing this library, see the | 8 * For information on installing and importing this library, see the |
| 9 * [unittest package on pub.dartlang.org] | 9 * [unittest package on pub.dartlang.org] |
| 10 * (http://pub.dartlang.org/packages/unittest). | 10 * (http://pub.dartlang.org/packages/unittest). |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 772 int errors = 0; | 772 int errors = 0; |
| 773 | 773 |
| 774 for (TestCase t in testCases) { | 774 for (TestCase t in testCases) { |
| 775 switch (t.result) { | 775 switch (t.result) { |
| 776 case PASS: passed++; break; | 776 case PASS: passed++; break; |
| 777 case FAIL: failed++; break; | 777 case FAIL: failed++; break; |
| 778 case ERROR: errors++; break; | 778 case ERROR: errors++; break; |
| 779 } | 779 } |
| 780 } | 780 } |
| 781 _config.onSummary(passed, failed, errors, testCases, _uncaughtErrorMessage); | 781 _config.onSummary(passed, failed, errors, testCases, _uncaughtErrorMessage); |
| 782 _config.onDone(passed > 0 && failed == 0 && errors == 0 && | 782 _config.onDone(failed == 0 && errors == 0 && _uncaughtErrorMessage == null); |
|
kustermann
2013/11/14 13:43:31
If there are 0 tests to be executed, the result is
|
ricow1
2013/11/14 14:42:27
I am unsure if we have other assumptions about thi
|
| 783 _uncaughtErrorMessage == null); | |
| 784 _initialized = false; | 783 _initialized = false; |
| 785 } | 784 } |
| 786 | 785 |
| 787 String _fullSpec(String spec) { | 786 String _fullSpec(String spec) { |
| 788 var group = '${_currentContext.fullName}'; | 787 var group = '${_currentContext.fullName}'; |
| 789 if (spec == null) return group; | 788 if (spec == null) return group; |
| 790 return group != '' ? '$group$groupSep$spec' : spec; | 789 return group != '' ? '$group$groupSep$spec' : spec; |
| 791 } | 790 } |
| 792 | 791 |
| 793 /** | 792 /** |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 | 874 |
| 876 if (!filterStacks) return trace; | 875 if (!filterStacks) return trace; |
| 877 | 876 |
| 878 // Format the stack trace by removing everything above TestCase._runTest, | 877 // Format the stack trace by removing everything above TestCase._runTest, |
| 879 // which is usually going to be irrelevant. Also fold together unittest and | 878 // which is usually going to be irrelevant. Also fold together unittest and |
| 880 // core library calls so only the function the user called is visible. | 879 // core library calls so only the function the user called is visible. |
| 881 return new Trace(trace.frames.takeWhile((frame) { | 880 return new Trace(trace.frames.takeWhile((frame) { |
| 882 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; | 881 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; |
| 883 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); | 882 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); |
| 884 } | 883 } |
| OLD | NEW |