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

Side by Side Diff: pkg/analyzer/test/src/command_line/arguments_test.dart

Issue 2571583007: move extractDefinedVariables from analyzer cli to analyzer (Closed)
Patch Set: Created 4 years 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
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 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 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 analyzer.test.src.context.context_builder_test; 5 library analyzer.test.src.context.context_builder_test;
6 6
7 import 'package:analyzer/file_system/memory_file_system.dart'; 7 import 'package:analyzer/file_system/memory_file_system.dart';
8 import 'package:analyzer/src/command_line/arguments.dart'; 8 import 'package:analyzer/src/command_line/arguments.dart';
9 import 'package:analyzer/src/context/builder.dart'; 9 import 'package:analyzer/src/context/builder.dart';
10 import 'package:analyzer/src/dart/sdk/sdk.dart'; 10 import 'package:analyzer/src/dart/sdk/sdk.dart';
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 expect(manager.defaultSdkDirectory, 'y'); 135 expect(manager.defaultSdkDirectory, 'y');
136 expect(manager.canUseSummaries, true); 136 expect(manager.canUseSummaries, true);
137 } 137 }
138 138
139 void test_defineAnalysisArguments() { 139 void test_defineAnalysisArguments() {
140 ArgParser parser = new ArgParser(); 140 ArgParser parser = new ArgParser();
141 defineAnalysisArguments(parser); 141 defineAnalysisArguments(parser);
142 expect(parser.options, hasLength(12)); 142 expect(parser.options, hasLength(12));
143 } 143 }
144 144
145 void test_extractDefinedVariables() {
146 List<String> args = ['--a', '-Dbaz', 'go', 'back=blue', '-Dx'];
147 Map<String, String> definedVariables = {'one': 'two'};
148 args = extractDefinedVariables(args, definedVariables);
149 expect(args, orderedEquals(['--a', 'back=blue', '-Dx']));
150 expect(definedVariables['one'], 'two');
151 expect(definedVariables['two'], isNull);
152 expect(definedVariables['baz'], 'go');
153 expect(definedVariables['go'], isNull);
154 expect(definedVariables, hasLength(2));
155 }
156
145 void test_filterUnknownArguments() { 157 void test_filterUnknownArguments() {
146 List<String> args = ['--a', '--b', '--c', 'foo', 'bar']; 158 List<String> args = ['--a', '--b', '--c', 'foo', 'bar'];
147 ArgParser parser = new ArgParser(); 159 ArgParser parser = new ArgParser();
148 parser.addFlag('a'); 160 parser.addFlag('a');
149 parser.addFlag('c'); 161 parser.addFlag('c');
150 List<String> result = filterUnknownArguments(args, parser); 162 List<String> result = filterUnknownArguments(args, parser);
151 expect(result, orderedEquals(['--a', '--c', 'foo', 'bar'])); 163 expect(result, orderedEquals(['--a', '--c', 'foo', 'bar']));
152 } 164 }
153 165
154 void test_parse_noReplacement_noIgnored() { 166 void test_parse_noReplacement_noIgnored() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 215 }
204 216
205 void test_preprocessArgs_replacement_notLast() { 217 void test_preprocessArgs_replacement_notLast() {
206 MemoryResourceProvider provider = new MemoryResourceProvider(); 218 MemoryResourceProvider provider = new MemoryResourceProvider();
207 String filePath = provider.convertPath('/args.txt'); 219 String filePath = provider.convertPath('/args.txt');
208 List<String> args = ['a', '@$filePath', 'b']; 220 List<String> args = ['a', '@$filePath', 'b'];
209 List<String> result = preprocessArgs(provider, args); 221 List<String> result = preprocessArgs(provider, args);
210 expect(result, orderedEquals(args)); 222 expect(result, orderedEquals(args));
211 } 223 }
212 } 224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698