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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library testing.expectation; | 5 library testing.expectation; |
6 | 6 |
7 /// An expectation represents the expected outcome of a test (or if it should | 7 /// An expectation represents the expected outcome of a test (or if it should |
8 /// be skipped). | 8 /// be skipped). |
9 /// | 9 /// |
10 /// An expectation belongs to a group, for example, [ExpectationGroup.Fail]. | 10 /// An expectation belongs to a group, for example, [ExpectationGroup.Fail]. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 return internalMap[name.toLowerCase()] ?? | 82 return internalMap[name.toLowerCase()] ?? |
83 (throw "No expectation named: '$name'."); | 83 (throw "No expectation named: '$name'."); |
84 } | 84 } |
85 | 85 |
86 factory ExpectationSet.fromJsonList(List data) { | 86 factory ExpectationSet.fromJsonList(List data) { |
87 Map<String, Expectation> internalMap = | 87 Map<String, Expectation> internalMap = |
88 new Map<String, Expectation>.from(Default.internalMap); | 88 new Map<String, Expectation>.from(Default.internalMap); |
89 for (Map map in data) { | 89 for (Map map in data) { |
90 String name; | 90 String name; |
91 String group; | 91 String group; |
92 map.forEach((String key, String value) { | 92 map.forEach((_key, _value) { |
| 93 String key = _key; |
| 94 String value = _value; |
93 switch (key) { | 95 switch (key) { |
94 case "name": | 96 case "name": |
95 name = value; | 97 name = value; |
96 break; | 98 break; |
97 | 99 |
98 case "group": | 100 case "group": |
99 group = value; | 101 group = value; |
100 break; | 102 break; |
101 | 103 |
102 default: | 104 default: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 case "Pass": | 142 case "Pass": |
141 return ExpectationGroup.Pass; | 143 return ExpectationGroup.Pass; |
142 case "Skip": | 144 case "Skip": |
143 return ExpectationGroup.Skip; | 145 return ExpectationGroup.Skip; |
144 case "Timeout": | 146 case "Timeout": |
145 return ExpectationGroup.Timeout; | 147 return ExpectationGroup.Timeout; |
146 default: | 148 default: |
147 throw "Unrecognized group: '$name'."; | 149 throw "Unrecognized group: '$name'."; |
148 } | 150 } |
149 } | 151 } |
OLD | NEW |