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 "status_file_parser.dart"; | 7 import "expectation.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 = | 41 bool containsSkipByDesign = expectations.contains(Expectation.skipByDesign); |
42 expectations.contains(Expectation.SKIP_BY_DESIGN); | 42 bool containsCrash = expectations.contains(Expectation.crash); |
43 bool containsCrash = expectations.contains(Expectation.CRASH); | 43 bool containsOK = expectations.contains(Expectation.ok); |
44 bool containsOK = expectations.contains(Expectation.OK); | 44 bool containsSlow = expectations.contains(Expectation.slow); |
45 bool containsSlow = expectations.contains(Expectation.SLOW); | 45 bool containsTimeout = expectations.contains(Expectation.timeout); |
46 bool containsTimeout = expectations.contains(Expectation.TIMEOUT); | |
47 | 46 |
48 ++_total; | 47 ++_total; |
49 if (containsSkip) { | 48 if (containsSkip) { |
50 ++_skipped; | 49 ++_skipped; |
51 } else if (containsSkipByDesign) { | 50 } else if (containsSkipByDesign) { |
52 ++_skipped; | 51 ++_skipped; |
53 ++_skippedByDesign; | 52 ++_skippedByDesign; |
54 } else { | 53 } else { |
55 // We don't do if-else below because the buckets should be exclusive. | 54 // We don't do if-else below because the buckets should be exclusive. |
56 // We keep a count around to guarantee that | 55 // We keep a count around to guarantee that |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 * $_timeout tests are allowed to timeout | 124 * $_timeout tests are allowed to timeout |
126 * $_compileErrorSkip tests are skipped on browsers due to compile-time error | 125 * $_compileErrorSkip tests are skipped on browsers due to compile-time error |
127 * $bogus could not be categorized or are in multiple categories | 126 * $bogus could not be categorized or are in multiple categories |
128 """; | 127 """; |
129 | 128 |
130 void printReport() { | 129 void printReport() { |
131 if (_total == 0) return; | 130 if (_total == 0) return; |
132 print(report); | 131 print(report); |
133 } | 132 } |
134 } | 133 } |
OLD | NEW |