Chromium Code Reviews| Index: pkg/analyzer/test/src/task/yaml_test.dart |
| diff --git a/pkg/analyzer/test/src/task/yaml_test.dart b/pkg/analyzer/test/src/task/yaml_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..698eff61fed10b80b0323723701445dee76853d2 |
| --- /dev/null |
| +++ b/pkg/analyzer/test/src/task/yaml_test.dart |
| @@ -0,0 +1,55 @@ |
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +library analyzer.test.src.task.yaml_test; |
| + |
| +import 'package:analyzer/src/generated/source.dart'; |
| +import 'package:analyzer/src/task/yaml.dart'; |
| +import 'package:analyzer/task/yaml.dart'; |
| +import 'package:unittest/unittest.dart'; |
| + |
| +import '../../reflective_tests.dart'; |
| +import '../../utils.dart'; |
| +import '../context/abstract_context.dart'; |
| + |
| +main() { |
| + initializeTestEnvironment(); |
| + runReflectiveTests(ParseYamlTaskTest); |
| +} |
| + |
| +isInstanceOf isParseYamlTask = new isInstanceOf<ParseYamlTask>(); |
| + |
| +@reflectiveTest |
| +class ParseYamlTaskTest extends AbstractContextTest { |
| + Source source; |
| + |
| + test_perform() { |
| + _performParseTask(r''' |
| +rules: |
| + style_guide: |
| + camel_case_types: false |
| +'''); |
| + expect(outputs, hasLength(3)); |
| + expect(outputs[YAML_DOCUMENT], isNotNull); |
| + expect(outputs[YAML_ERRORS], hasLength(0)); |
| + expect(outputs[YAML_LINE_INFO], isNotNull); |
|
scheglov
2016/01/24 18:20:44
These expect(s) and in the test below are IMHO too
Brian Wilkerson
2016/01/24 23:14:44
True. More complete tests added.
|
| + } |
| + |
| + test_perform_doesNotExist() { |
| + _performParseTask(null); |
| + expect(outputs, hasLength(3)); |
| + expect(outputs[YAML_DOCUMENT], isNotNull); |
| + expect(outputs[YAML_ERRORS], hasLength(1)); |
| + expect(outputs[YAML_LINE_INFO], isNotNull); |
| + } |
| + |
| + void _performParseTask(String content) { |
| + if (content == null) { |
| + source = resourceProvider.getFile('/test.dart').createSource(); |
|
scheglov
2016/01/24 18:20:44
test.yaml ?
Brian Wilkerson
2016/01/24 23:14:44
Done
|
| + } else { |
| + source = newSource('/test.dart', content); |
| + } |
| + computeResult(source, YAML_DOCUMENT, matcher: isParseYamlTask); |
| + } |
| +} |