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

Side by Side Diff: pkg/analyzer/test/src/plugin/plugin_config_test.dart

Issue 1366663002: Plugin config cleanup. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/lib/src/plugin/plugin_configuration.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
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library test.src.plugin.plugin_config_test; 5 library test.src.plugin.plugin_config_test;
6 6
7 import 'package:analyzer/source/analysis_options_provider.dart'; 7 import 'package:analyzer/source/analysis_options_provider.dart';
8 import 'package:analyzer/src/plugin/plugin_configuration.dart'; 8 import 'package:analyzer/src/plugin/plugin_configuration.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:yaml/yaml.dart'; 10 import 'package:yaml/yaml.dart';
(...skipping 27 matching lines...) Expand all
38 expect(plugins[2].className, equals('MyPlugin')); 38 expect(plugins[2].className, equals('MyPlugin'));
39 }); 39 });
40 test('plugin map (empty)', () { 40 test('plugin map (empty)', () {
41 const optionsSrc = ''' 41 const optionsSrc = '''
42 analyzer: 42 analyzer:
43 plugins: 43 plugins:
44 # my_plugin1: ^0.1.0 #shorthand 44 # my_plugin1: ^0.1.0 #shorthand
45 '''; 45 ''';
46 var config = parseConfig(optionsSrc); 46 var config = parseConfig(optionsSrc);
47 // Commented out plugins shouldn't cause a parse failure. 47 // Commented out plugins shouldn't cause a parse failure.
48 expect(config.plugins.toList(), hasLength(0)); 48 expect(config.plugins, hasLength(0));
49 }); 49 });
50 group('errors', () { 50 group('errors', () {
51 test('bad format', () { 51 test('bad format', () {
52 const optionsSrc = ''' 52 const optionsSrc = '''
53 analyzer: 53 analyzer:
54 plugins: 54 plugins:
55 - my_plugin1 55 - my_plugin1
56 - my_plugin2 56 - my_plugin2
57 '''; 57 ''';
58 try { 58 try {
(...skipping 12 matching lines...) Expand all
71 }); 71 });
72 } 72 }
73 73
74 PluginConfig parseConfig(String optionsSrc) { 74 PluginConfig parseConfig(String optionsSrc) {
75 var options = new AnalysisOptionsProvider().getOptionsFromString(optionsSrc); 75 var options = new AnalysisOptionsProvider().getOptionsFromString(optionsSrc);
76 return new PluginConfig.fromOptions(options); 76 return new PluginConfig.fromOptions(options);
77 } 77 }
78 78
79 List<PluginInfo> pluginsSortedByName(PluginConfig config) => 79 List<PluginInfo> pluginsSortedByName(PluginConfig config) =>
80 config.plugins.toList()..sort((p1, p2) => p1.name.compareTo(p2.name)); 80 config.plugins.toList()..sort((p1, p2) => p1.name.compareTo(p2.name));
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/plugin/plugin_configuration.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698