Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library analyzer.test.src.task.yaml_test; | |
| 6 | |
| 7 import 'package:analyzer/src/generated/source.dart'; | |
| 8 import 'package:analyzer/src/task/yaml.dart'; | |
| 9 import 'package:analyzer/task/yaml.dart'; | |
| 10 import 'package:unittest/unittest.dart'; | |
| 11 | |
| 12 import '../../reflective_tests.dart'; | |
| 13 import '../../utils.dart'; | |
| 14 import '../context/abstract_context.dart'; | |
| 15 | |
| 16 main() { | |
| 17 initializeTestEnvironment(); | |
| 18 runReflectiveTests(ParseYamlTaskTest); | |
| 19 } | |
| 20 | |
| 21 isInstanceOf isParseYamlTask = new isInstanceOf<ParseYamlTask>(); | |
| 22 | |
| 23 @reflectiveTest | |
| 24 class ParseYamlTaskTest extends AbstractContextTest { | |
| 25 Source source; | |
| 26 | |
| 27 test_perform() { | |
| 28 _performParseTask(r''' | |
| 29 rules: | |
| 30 style_guide: | |
| 31 camel_case_types: false | |
| 32 '''); | |
| 33 expect(outputs, hasLength(3)); | |
| 34 expect(outputs[YAML_DOCUMENT], isNotNull); | |
| 35 expect(outputs[YAML_ERRORS], hasLength(0)); | |
| 36 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.
| |
| 37 } | |
| 38 | |
| 39 test_perform_doesNotExist() { | |
| 40 _performParseTask(null); | |
| 41 expect(outputs, hasLength(3)); | |
| 42 expect(outputs[YAML_DOCUMENT], isNotNull); | |
| 43 expect(outputs[YAML_ERRORS], hasLength(1)); | |
| 44 expect(outputs[YAML_LINE_INFO], isNotNull); | |
| 45 } | |
| 46 | |
| 47 void _performParseTask(String content) { | |
| 48 if (content == null) { | |
| 49 source = resourceProvider.getFile('/test.dart').createSource(); | |
|
scheglov
2016/01/24 18:20:44
test.yaml ?
Brian Wilkerson
2016/01/24 23:14:44
Done
| |
| 50 } else { | |
| 51 source = newSource('/test.dart', content); | |
| 52 } | |
| 53 computeResult(source, YAML_DOCUMENT, matcher: isParseYamlTask); | |
| 54 } | |
| 55 } | |
| OLD | NEW |