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