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

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

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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
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/general.dart';
10 import 'package:analyzer/task/yaml.dart';
11 import 'package:test_reflective_loader/test_reflective_loader.dart';
12 import 'package:unittest/unittest.dart';
13 import 'package:yaml/yaml.dart';
14
15 import '../../utils.dart';
16 import '../context/abstract_context.dart';
17
18 main() {
19 initializeTestEnvironment();
20 defineReflectiveTests(ParseYamlTaskTest);
21 }
22
23 isInstanceOf isParseYamlTask = new isInstanceOf<ParseYamlTask>();
24
25 @reflectiveTest
26 class ParseYamlTaskTest extends AbstractContextTest {
27 Source source;
28
29 test_perform() {
30 _performParseTask(r'''
31 rules:
32 style_guide:
33 camel_case_types: false
34 ''');
35 expect(outputs, hasLength(3));
36 YamlDocument document = outputs[YAML_DOCUMENT];
37 expect(document, isNotNull);
38 var value = document.contents.value;
39 expect(value, new isInstanceOf<Map>());
40 expect(value['rules']['style_guide']['camel_case_types'], isFalse);
41 expect(outputs[YAML_ERRORS], hasLength(0));
42 LineInfo lineInfo = outputs[LINE_INFO];
43 expect(lineInfo, isNotNull);
44 expect(lineInfo.getOffsetOfLine(0), 0);
45 expect(lineInfo.getOffsetOfLine(1), 7);
46 expect(lineInfo.getOffsetOfLine(2), 22);
47 expect(lineInfo.getOffsetOfLine(3), 50);
48 }
49
50 test_perform_doesNotExist() {
51 _performParseTask(null);
52 expect(outputs, hasLength(3));
53 YamlDocument document = outputs[YAML_DOCUMENT];
54 expect(document, isNotNull);
55 expect(document.contents.value, isNull);
56 expect(outputs[YAML_ERRORS], hasLength(1));
57 LineInfo lineInfo = outputs[LINE_INFO];
58 expect(lineInfo, isNotNull);
59 expect(lineInfo.getOffsetOfLine(0), 0);
60 }
61
62 void _performParseTask(String content) {
63 if (content == null) {
64 source = resourceProvider.getFile('/test.yaml').createSource();
65 } else {
66 source = newSource('/test.yaml', content);
67 }
68 computeResult(source, YAML_DOCUMENT, matcher: isParseYamlTask);
69 }
70 }
OLDNEW
« no previous file with comments | « packages/analyzer/test/src/task/test_support.dart ('k') | packages/analyzer/test/src/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698