OLD | NEW |
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 summary_report; | 5 library summary_report; |
6 | 6 |
7 import "expectation.dart"; | 7 import "status_file_parser.dart"; |
8 import "test_runner.dart"; | 8 import "test_runner.dart"; |
9 | 9 |
10 final summaryReport = new SummaryReport(); | 10 final summaryReport = new SummaryReport(); |
11 | 11 |
12 class SummaryReport { | 12 class SummaryReport { |
13 int _total = 0; | 13 int _total = 0; |
14 int _skipped = 0; | 14 int _skipped = 0; |
15 int _skippedByDesign = 0; | 15 int _skippedByDesign = 0; |
16 int _noCrash = 0; | 16 int _noCrash = 0; |
17 int _flakyCrash = 0; | 17 int _flakyCrash = 0; |
18 int _pass = 0; | 18 int _pass = 0; |
19 int _failOk = 0; | 19 int _failOk = 0; |
20 int _fail = 0; | 20 int _fail = 0; |
21 int _crash = 0; | 21 int _crash = 0; |
22 int _timeout = 0; | 22 int _timeout = 0; |
23 int _compileErrorSkip = 0; | 23 int _compileErrorSkip = 0; |
24 | 24 |
25 int get total => _total; | 25 int get total => _total; |
26 | 26 |
27 int get skippedOther => _skipped - _skippedByDesign; | 27 int get skippedOther => _skipped - _skippedByDesign; |
28 | 28 |
29 int get bogus => _nonStandardTestCases.length; | 29 int get bogus => _nonStandardTestCases.length; |
30 | 30 |
31 final List<TestCase> _nonStandardTestCases = <TestCase>[]; | 31 final List<TestCase> _nonStandardTestCases = <TestCase>[]; |
32 | 32 |
33 void add(TestCase testCase) { | 33 void add(TestCase testCase) { |
34 var expectations = testCase.expectedOutcomes; | 34 var expectations = testCase.expectedOutcomes; |
35 | 35 |
36 bool containsFail = expectations | 36 bool containsFail = expectations |
37 .any((expectation) => expectation.canBeOutcomeOf(Expectation.fail)); | 37 .any((expectation) => expectation.canBeOutcomeOf(Expectation.FAIL)); |
38 bool containsPass = expectations.contains(Expectation.pass); | 38 bool containsPass = expectations.contains(Expectation.PASS); |
39 bool containsSkip = expectations | 39 bool containsSkip = expectations |
40 .any((expectation) => expectation.canBeOutcomeOf(Expectation.skip)); | 40 .any((expectation) => expectation.canBeOutcomeOf(Expectation.SKIP)); |
41 bool containsSkipByDesign = expectations.contains(Expectation.skipByDesign); | 41 bool containsSkipByDesign = |
42 bool containsCrash = expectations.contains(Expectation.crash); | 42 expectations.contains(Expectation.SKIP_BY_DESIGN); |
43 bool containsOK = expectations.contains(Expectation.ok); | 43 bool containsCrash = expectations.contains(Expectation.CRASH); |
44 bool containsSlow = expectations.contains(Expectation.slow); | 44 bool containsOK = expectations.contains(Expectation.OK); |
45 bool containsTimeout = expectations.contains(Expectation.timeout); | 45 bool containsSlow = expectations.contains(Expectation.SLOW); |
| 46 bool containsTimeout = expectations.contains(Expectation.TIMEOUT); |
46 | 47 |
47 ++_total; | 48 ++_total; |
48 if (containsSkip) { | 49 if (containsSkip) { |
49 ++_skipped; | 50 ++_skipped; |
50 } else if (containsSkipByDesign) { | 51 } else if (containsSkipByDesign) { |
51 ++_skipped; | 52 ++_skipped; |
52 ++_skippedByDesign; | 53 ++_skippedByDesign; |
53 } else { | 54 } else { |
54 // We don't do if-else below because the buckets should be exclusive. | 55 // We don't do if-else below because the buckets should be exclusive. |
55 // We keep a count around to guarantee that | 56 // We keep a count around to guarantee that |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 * $_timeout tests are allowed to timeout | 125 * $_timeout tests are allowed to timeout |
125 * $_compileErrorSkip tests are skipped on browsers due to compile-time error | 126 * $_compileErrorSkip tests are skipped on browsers due to compile-time error |
126 * $bogus could not be categorized or are in multiple categories | 127 * $bogus could not be categorized or are in multiple categories |
127 """; | 128 """; |
128 | 129 |
129 void printReport() { | 130 void printReport() { |
130 if (_total == 0) return; | 131 if (_total == 0) return; |
131 print(report); | 132 print(report); |
132 } | 133 } |
133 } | 134 } |
OLD | NEW |