| 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 int errors = 0; | 778 int errors = 0; |
| 779 | 779 |
| 780 for (TestCase t in testCases) { | 780 for (TestCase t in testCases) { |
| 781 switch (t.result) { | 781 switch (t.result) { |
| 782 case PASS: passed++; break; | 782 case PASS: passed++; break; |
| 783 case FAIL: failed++; break; | 783 case FAIL: failed++; break; |
| 784 case ERROR: errors++; break; | 784 case ERROR: errors++; break; |
| 785 } | 785 } |
| 786 } | 786 } |
| 787 _config.onSummary(passed, failed, errors, testCases, _uncaughtErrorMessage); | 787 _config.onSummary(passed, failed, errors, testCases, _uncaughtErrorMessage); |
| 788 _config.onDone(passed > 0 && failed == 0 && errors == 0 && | 788 _config.onDone(failed == 0 && errors == 0 && _uncaughtErrorMessage == null); |
| 789 _uncaughtErrorMessage == null); | |
| 790 _initialized = false; | 789 _initialized = false; |
| 791 } | 790 } |
| 792 | 791 |
| 793 String _fullSpec(String spec) { | 792 String _fullSpec(String spec) { |
| 794 var group = '${_currentContext.fullName}'; | 793 var group = '${_currentContext.fullName}'; |
| 795 if (spec == null) return group; | 794 if (spec == null) return group; |
| 796 return group != '' ? '$group$groupSep$spec' : spec; | 795 return group != '' ? '$group$groupSep$spec' : spec; |
| 797 } | 796 } |
| 798 | 797 |
| 799 /** | 798 /** |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 880 |
| 882 if (!filterStacks) return trace; | 881 if (!filterStacks) return trace; |
| 883 | 882 |
| 884 // Format the stack trace by removing everything above TestCase._runTest, | 883 // Format the stack trace by removing everything above TestCase._runTest, |
| 885 // which is usually going to be irrelevant. Also fold together unittest and | 884 // which is usually going to be irrelevant. Also fold together unittest and |
| 886 // core library calls so only the function the user called is visible. | 885 // core library calls so only the function the user called is visible. |
| 887 return new Trace(trace.frames.takeWhile((frame) { | 886 return new Trace(trace.frames.takeWhile((frame) { |
| 888 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; | 887 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; |
| 889 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); | 888 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); |
| 890 } | 889 } |
| OLD | NEW |