| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:boolean_selector/boolean_selector.dart'; |
| 7 import 'package:glob/glob.dart'; | 8 import 'package:glob/glob.dart'; |
| 8 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 9 import 'package:source_span/source_span.dart'; | 10 import 'package:source_span/source_span.dart'; |
| 10 import 'package:yaml/yaml.dart'; | 11 import 'package:yaml/yaml.dart'; |
| 11 | 12 |
| 12 import '../../backend/test_platform.dart'; | 13 import '../../backend/test_platform.dart'; |
| 13 import '../../frontend/timeout.dart'; | 14 import '../../frontend/timeout.dart'; |
| 14 import '../../utils.dart'; | 15 import '../../utils.dart'; |
| 15 import '../configuration.dart'; | 16 import '../configuration.dart'; |
| 16 import 'values.dart'; | 17 import 'values.dart'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 63 |
| 63 var addTags = _getList("add_tags", (tagNode) { | 64 var addTags = _getList("add_tags", (tagNode) { |
| 64 _validate(tagNode, "Tags must be strings.", (value) => value is String); | 65 _validate(tagNode, "Tags must be strings.", (value) => value is String); |
| 65 _validate( | 66 _validate( |
| 66 tagNode, | 67 tagNode, |
| 67 "Invalid tag. Tags must be (optionally hyphenated) Dart identifiers.", | 68 "Invalid tag. Tags must be (optionally hyphenated) Dart identifiers.", |
| 68 (value) => value.contains(anchoredHyphenatedIdentifier)); | 69 (value) => value.contains(anchoredHyphenatedIdentifier)); |
| 69 return tagNode.value; | 70 return tagNode.value; |
| 70 }); | 71 }); |
| 71 | 72 |
| 72 var tags = _getMap("tags", key: (keyNode) { | 73 var tags = _getMap("tags", |
| 73 _validate(keyNode, "tags key must be a string.", | 74 key: (keyNode) => _parseNode(keyNode, "tags key", |
| 74 (value) => value is String); | 75 (value) => new BooleanSelector.parse(value)), |
| 75 _validate( | 76 value: (valueNode) => |
| 76 keyNode, | 77 _nestedConfig(valueNode, "tag value", runnerConfig: false)); |
| 77 "Invalid tag. Tags must be (optionally hyphenated) Dart identifiers.", | |
| 78 (value) => value.contains(anchoredHyphenatedIdentifier)); | |
| 79 | |
| 80 return keyNode.value; | |
| 81 }, value: (valueNode) { | |
| 82 return _nestedConfig(valueNode, "tag value", runnerConfig: false); | |
| 83 }); | |
| 84 | 78 |
| 85 return new Configuration( | 79 return new Configuration( |
| 86 verboseTrace: verboseTrace, | 80 verboseTrace: verboseTrace, |
| 87 jsTrace: jsTrace, | 81 jsTrace: jsTrace, |
| 88 timeout: timeout, | 82 timeout: timeout, |
| 89 addTags: addTags, | 83 addTags: addTags, |
| 90 tags: tags); | 84 tags: tags); |
| 91 } | 85 } |
| 92 | 86 |
| 93 /// Loads runner configuration (but not test configuration). | 87 /// Loads runner configuration (but not test configuration). |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (!_document.containsKey(field)) return; | 261 if (!_document.containsKey(field)) return; |
| 268 _error("$field isn't supported here.", field); | 262 _error("$field isn't supported here.", field); |
| 269 } | 263 } |
| 270 | 264 |
| 271 /// Throws a [SourceSpanFormatException] with [message] about [field]. | 265 /// Throws a [SourceSpanFormatException] with [message] about [field]. |
| 272 void _error(String message, String field) { | 266 void _error(String message, String field) { |
| 273 throw new SourceSpanFormatException( | 267 throw new SourceSpanFormatException( |
| 274 message, _document.nodes[field].span, _source); | 268 message, _document.nodes[field].span, _source); |
| 275 } | 269 } |
| 276 } | 270 } |
| OLD | NEW |