Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: pkg/analyzer/test/src/task/yaml_test.dart

Issue 1622313003: Add minimal yaml support to the engine (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address Comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/src/task/test_all.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 import 'package:yaml/yaml.dart';
12
13 import '../../reflective_tests.dart';
14 import '../../utils.dart';
15 import '../context/abstract_context.dart';
16
17 main() {
18 initializeTestEnvironment();
19 runReflectiveTests(ParseYamlTaskTest);
20 }
21
22 isInstanceOf isParseYamlTask = new isInstanceOf<ParseYamlTask>();
23
24 @reflectiveTest
25 class ParseYamlTaskTest extends AbstractContextTest {
26 Source source;
27
28 test_perform() {
29 _performParseTask(r'''
30 rules:
31 style_guide:
32 camel_case_types: false
33 ''');
34 expect(outputs, hasLength(3));
35 YamlDocument document = outputs[YAML_DOCUMENT];
36 expect(document, isNotNull);
37 var value = document.contents.value;
38 expect(value, new isInstanceOf<Map>());
39 expect(value['rules']['style_guide']['camel_case_types'], isFalse);
40 expect(outputs[YAML_ERRORS], hasLength(0));
41 LineInfo lineInfo = outputs[YAML_LINE_INFO];
42 expect(lineInfo, isNotNull);
43 expect(lineInfo.getOffsetOfLine(0), 0);
44 expect(lineInfo.getOffsetOfLine(1), 7);
45 expect(lineInfo.getOffsetOfLine(2), 22);
46 expect(lineInfo.getOffsetOfLine(3), 50);
47 }
48
49 test_perform_doesNotExist() {
50 _performParseTask(null);
51 expect(outputs, hasLength(3));
52 YamlDocument document = outputs[YAML_DOCUMENT];
53 expect(document, isNotNull);
54 expect(document.contents.value, isNull);
55 expect(outputs[YAML_ERRORS], hasLength(1));
56 LineInfo lineInfo = outputs[YAML_LINE_INFO];
57 expect(lineInfo, isNotNull);
58 expect(lineInfo.getOffsetOfLine(0), 0);
59 }
60
61 void _performParseTask(String content) {
62 if (content == null) {
63 source = resourceProvider.getFile('/test.yaml').createSource();
64 } else {
65 source = newSource('/test.yaml', content);
66 }
67 computeResult(source, YAML_DOCUMENT, matcher: isParseYamlTask);
68 }
69 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/test_all.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698