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

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

Issue 1649663003: Add basic support for a configuration file. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 10 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
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:stack_trace/stack_trace.dart'; 11 import 'package:stack_trace/stack_trace.dart';
11 import 'package:yaml/yaml.dart'; 12 import 'package:yaml/yaml.dart';
12 13
13 import 'runner.dart'; 14 import 'runner.dart';
14 import 'runner/application_exception.dart'; 15 import 'runner/application_exception.dart';
15 import 'runner/configuration.dart'; 16 import 'runner/configuration.dart';
16 import 'runner/version.dart'; 17 import 'runner/version.dart';
17 import 'util/exit_codes.dart' as exit_codes; 18 import 'util/exit_codes.dart' as exit_codes;
18 import 'util/io.dart'; 19 import 'util/io.dart';
19 import 'utils.dart'; 20 import 'utils.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 var version = testVersion; 78 var version = testVersion;
78 if (version == null) { 79 if (version == null) {
79 stderr.writeln("Couldn't find version number."); 80 stderr.writeln("Couldn't find version number.");
80 exitCode = exit_codes.data; 81 exitCode = exit_codes.data;
81 } else { 82 } else {
82 print(version); 83 print(version);
83 } 84 }
84 return; 85 return;
85 } 86 }
86 87
88 try {
89 if (new File("dart_test.yaml").existsSync()) {
90 var fileConfiguration = new Configuration.load("dart_test.yaml");
91 configuration = fileConfiguration.merge(configuration);
92 }
93 } on SourceSpanFormatException catch (error) {
94 stderr.writeln(error.toString(color: configuration.color));
95 exitCode = exit_codes.data;
96 return;
97 } on FormatException catch (error) {
98 stderr.writeln(error.message);
99 exitCode = exit_codes.data;
100 return;
101 } on IOException catch (error) {
102 stderr.writeln(error.toString());
103 exitCode = exit_codes.noInput;
104 return;
105 }
106
87 if (configuration.pubServeUrl != null && !_usesTransformer) { 107 if (configuration.pubServeUrl != null && !_usesTransformer) {
88 stderr.write(''' 108 stderr.write('''
89 When using --pub-serve, you must include the "test/pub_serve" transformer in 109 When using --pub-serve, you must include the "test/pub_serve" transformer in
90 your pubspec: 110 your pubspec:
91 111
92 transformers: 112 transformers:
93 - test/pub_serve: 113 - test/pub_serve:
94 \$include: test/**_test.dart 114 \$include: test/**_test.dart
95 '''); 115 ''');
96 exitCode = exit_codes.data; 116 exitCode = exit_codes.data;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 output = stderr; 169 output = stderr;
150 } 170 }
151 171
152 output.write("""$message 172 output.write("""$message
153 173
154 Usage: pub run test:test [files or directories...] 174 Usage: pub run test:test [files or directories...]
155 175
156 ${Configuration.usage} 176 ${Configuration.usage}
157 """); 177 """);
158 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698