| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 status_file_parser; | 5 library status_file_parser; |
| 6 | 6 |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:convert" show LineSplitter, UTF8; | 8 import "dart:convert" show LineSplitter, UTF8; |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 static Expectation MISSING_STATIC_WARNING = byName('MissingStaticWarning'); | 28 static Expectation MISSING_STATIC_WARNING = byName('MissingStaticWarning'); |
| 29 static Expectation PUB_GET_ERROR = byName('PubGetError'); | 29 static Expectation PUB_GET_ERROR = byName('PubGetError'); |
| 30 | 30 |
| 31 // "meta expectations" | 31 // "meta expectations" |
| 32 static Expectation OK = byName('Ok'); | 32 static Expectation OK = byName('Ok'); |
| 33 static Expectation SLOW = byName('Slow'); | 33 static Expectation SLOW = byName('Slow'); |
| 34 static Expectation SKIP = byName('Skip'); | 34 static Expectation SKIP = byName('Skip'); |
| 35 static Expectation SKIP_SLOW = byName('SkipSlow'); | 35 static Expectation SKIP_SLOW = byName('SkipSlow'); |
| 36 static Expectation SKIP_BY_DESIGN = byName('SkipByDesign'); | 36 static Expectation SKIP_BY_DESIGN = byName('SkipByDesign'); |
| 37 | 37 |
| 38 // Can be returned by the test runner to say the result should be ignored, |
| 39 // and assumed to meet the expectations, due to an infrastructure failure. |
| 40 // Do not place in status files. |
| 41 static Expectation IGNORE = byName('Ignore'); |
| 42 |
| 38 static Expectation byName(String name) { | 43 static Expectation byName(String name) { |
| 39 _initialize(); | 44 _initialize(); |
| 40 name = name.toLowerCase(); | 45 name = name.toLowerCase(); |
| 41 if (!_AllExpectations.containsKey(name)) { | 46 if (!_AllExpectations.containsKey(name)) { |
| 42 throw new Exception("Expectation.byName(name='$name'): Invalid name."); | 47 throw new Exception("Expectation.byName(name='$name'): Invalid name."); |
| 43 } | 48 } |
| 44 return _AllExpectations[name]; | 49 return _AllExpectations[name]; |
| 45 } | 50 } |
| 46 | 51 |
| 47 // Keep a map of all possible Expectation objects, initialized lazily. | 52 // Keep a map of all possible Expectation objects, initialized lazily. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 build("MissingStaticWarning", group: fail); | 75 build("MissingStaticWarning", group: fail); |
| 71 build("StaticWarning", group: fail); | 76 build("StaticWarning", group: fail); |
| 72 | 77 |
| 73 build("PubGetError", group: fail); | 78 build("PubGetError", group: fail); |
| 74 | 79 |
| 75 var skip = build("Skip", isMetaExpectation: true); | 80 var skip = build("Skip", isMetaExpectation: true); |
| 76 build("SkipByDesign", isMetaExpectation: true); | 81 build("SkipByDesign", isMetaExpectation: true); |
| 77 build("SkipSlow", group: skip, isMetaExpectation: true); | 82 build("SkipSlow", group: skip, isMetaExpectation: true); |
| 78 build("Ok", isMetaExpectation: true); | 83 build("Ok", isMetaExpectation: true); |
| 79 build("Slow", isMetaExpectation: true); | 84 build("Slow", isMetaExpectation: true); |
| 85 build("Ignore"); |
| 80 } | 86 } |
| 81 } | 87 } |
| 82 | 88 |
| 83 final String prettyName; | 89 final String prettyName; |
| 84 final String name; | 90 final String name; |
| 85 final Expectation group; | 91 final Expectation group; |
| 86 // Indicates whether this expectation cannot be a test outcome (i.e. it is a | 92 // Indicates whether this expectation cannot be a test outcome (i.e. it is a |
| 87 // "meta marker"). | 93 // "meta marker"). |
| 88 final bool isMetaExpectation; | 94 final bool isMetaExpectation; |
| 89 | 95 |
| 90 Expectation._(prettyName, | 96 Expectation._(prettyName, |
| 91 {Expectation this.group: null, bool this.isMetaExpectation: false}) | 97 {Expectation this.group: null, bool this.isMetaExpectation: false}) |
| 92 : prettyName = prettyName, | 98 : prettyName = prettyName, |
| 93 name = prettyName.toLowerCase(); | 99 name = prettyName.toLowerCase(); |
| 94 | 100 |
| 95 bool canBeOutcomeOf(Expectation expectation) { | 101 bool canBeOutcomeOf(Expectation expectation) { |
| 96 Expectation outcome = this; | 102 Expectation outcome = this; |
| 103 if (outcome == IGNORE) return true; |
| 97 while (outcome != null) { | 104 while (outcome != null) { |
| 98 if (outcome == expectation) { | 105 if (outcome == expectation) { |
| 99 return true; | 106 return true; |
| 100 } | 107 } |
| 101 outcome = outcome.group; | 108 outcome = outcome.group; |
| 102 } | 109 } |
| 103 return false; | 110 return false; |
| 104 } | 111 } |
| 105 | 112 |
| 106 String toString() => prettyName; | 113 String toString() => prettyName; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 339 } |
| 333 regExps[i] = regExp; | 340 regExps[i] = regExp; |
| 334 } | 341 } |
| 335 _keyToRegExps[key] = regExps; | 342 _keyToRegExps[key] = regExps; |
| 336 }); | 343 }); |
| 337 | 344 |
| 338 _regExpCache = null; | 345 _regExpCache = null; |
| 339 _preprocessed = true; | 346 _preprocessed = true; |
| 340 } | 347 } |
| 341 } | 348 } |
| OLD | NEW |