OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// An entry found in the test.py logs corresponding to a test failure. | 5 /// An entry found in the test.py logs corresponding to a test failure. |
6 /// | 6 /// |
7 /// It stores what suite, test, and configuration was the failure seen at. | 7 /// It stores what suite, test, and configuration was the failure seen at. |
8 library status_files.record; | 8 library status_files.record; |
9 | 9 |
10 class Record implements Comparable<Record> { | 10 class Record implements Comparable<Record> { |
11 final String suite; | 11 final String suite; |
12 final String test; | 12 final String test; |
13 final String config; | 13 final String config; |
14 final String expected; | 14 final String expected; |
15 final String actual; | 15 final String actual; |
16 final String repro; | 16 final String repro; |
| 17 final String reason; |
17 | 18 |
18 // TODO(sigmund): extract also a failure reason if any (e.g. a stack trace or | 19 // TODO(sigmund): extract also a failure reason if any (e.g. a stack trace or |
19 // error message for crashes). | 20 // error message for crashes). |
20 | 21 |
21 bool get isPassing => actual == 'Pass'; | 22 bool get isPassing => actual == 'Pass'; |
22 | 23 |
23 Record(this.suite, this.test, this.config, this.expected, this.actual, | 24 Record(this.suite, this.test, this.config, this.expected, this.actual, |
24 this.repro); | 25 this.reason, this.repro); |
25 | 26 |
26 int compareTo(Record other) { | 27 int compareTo(Record other) { |
27 if (suite == null && other.suite != null) return -1; | 28 if (suite == null && other.suite != null) return -1; |
28 if (suite != null && other.suite == null) return 1; | 29 if (suite != null && other.suite == null) return 1; |
29 if (test == null && other.test != null) return -1; | 30 if (test == null && other.test != null) return -1; |
30 if (test != null && other.test == null) return 1; | 31 if (test != null && other.test == null) return 1; |
31 | 32 |
32 var suiteDiff = suite.compareTo(other.suite); | 33 var suiteDiff = suite.compareTo(other.suite); |
33 if (suiteDiff != 0) return suiteDiff; | 34 if (suiteDiff != 0) return suiteDiff; |
34 | 35 |
35 if (isPassing && !other.isPassing) return -1; | 36 if (isPassing && !other.isPassing) return -1; |
36 if (!isPassing && other.isPassing) return 1; | 37 if (!isPassing && other.isPassing) return 1; |
37 | 38 |
38 var testDiff = test.compareTo(other.test); | 39 var testDiff = test.compareTo(other.test); |
39 if (testDiff != 0) return testDiff; | 40 if (testDiff != 0) return testDiff; |
40 return repro.compareTo(other.repro); | 41 return repro.compareTo(other.repro); |
41 } | 42 } |
42 | 43 |
43 bool operator ==(covariant Record other) => | 44 bool operator ==(covariant Record other) => |
44 suite == other.suite && | 45 suite == other.suite && |
45 test == other.test && | 46 test == other.test && |
46 config == other.config && | 47 config == other.config && |
47 expected == other.expected && | 48 expected == other.expected && |
48 actual == other.actual && | 49 actual == other.actual && |
49 repro == other.repro; | 50 repro == other.repro; |
50 } | 51 } |
OLD | NEW |