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

Side by Side Diff: lib/src/executable.dart

Issue 1782473005: Add support for configuration presets. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 9 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 | « lib/src/backend/metadata.dart ('k') | lib/src/runner/configuration.dart » ('j') | 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 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy 5 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy
6 // package. Once that package is no longer being updated, move this back into 6 // package. Once that package is no longer being updated, move this back into
7 // bin. 7 // bin.
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:source_span/source_span.dart'; 10 import 'package:source_span/source_span.dart';
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } on FormatException catch (error) { 97 } on FormatException catch (error) {
98 stderr.writeln(error.message); 98 stderr.writeln(error.message);
99 exitCode = exit_codes.data; 99 exitCode = exit_codes.data;
100 return; 100 return;
101 } on IOException catch (error) { 101 } on IOException catch (error) {
102 stderr.writeln(error.toString()); 102 stderr.writeln(error.toString());
103 exitCode = exit_codes.noInput; 103 exitCode = exit_codes.noInput;
104 return; 104 return;
105 } 105 }
106 106
107 var undefinedPresets =
108 configuration.chosenPresets
109 .where((preset) => !configuration.knownPresets.contains(preset))
110 .toList();
111 if (undefinedPresets.isNotEmpty) {
112 _printUsage("Undefined ${pluralize('preset', undefinedPresets.length)} "
113 "${toSentence(undefinedPresets.map((preset) => '"$preset"'))}.");
114 exitCode = exit_codes.usage;
115 return;
116 }
117
107 if (configuration.pubServeUrl != null && !_usesTransformer) { 118 if (configuration.pubServeUrl != null && !_usesTransformer) {
108 stderr.write(''' 119 stderr.write('''
109 When using --pub-serve, you must include the "test/pub_serve" transformer in 120 When using --pub-serve, you must include the "test/pub_serve" transformer in
110 your pubspec: 121 your pubspec:
111 122
112 transformers: 123 transformers:
113 - test/pub_serve: 124 - test/pub_serve:
114 \$include: test/**_test.dart 125 \$include: test/**_test.dart
115 '''); 126 ''');
116 exitCode = exit_codes.data; 127 exitCode = exit_codes.data;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 /// thing is printed to stderr instead of stdout. 173 /// thing is printed to stderr instead of stdout.
163 void _printUsage([String error]) { 174 void _printUsage([String error]) {
164 var output = stdout; 175 var output = stdout;
165 176
166 var message = "Runs tests in this package."; 177 var message = "Runs tests in this package.";
167 if (error != null) { 178 if (error != null) {
168 message = error; 179 message = error;
169 output = stderr; 180 output = stderr;
170 } 181 }
171 182
172 output.write("""$message 183 output.write("""${wordWrap(message)}
173 184
174 Usage: pub run test:test [files or directories...] 185 Usage: pub run test:test [files or directories...]
175 186
176 ${Configuration.usage} 187 ${Configuration.usage}
177 """); 188 """);
178 } 189 }
OLDNEW
« no previous file with comments | « lib/src/backend/metadata.dart ('k') | lib/src/runner/configuration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698