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

Side by Side Diff: bin/unittest.dart

Issue 948113004: Support Dart 1.8.0. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | lib/src/dart.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 library unittest.unittest; 5 library unittest.unittest;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
11 import 'package:args/args.dart'; 11 import 'package:args/args.dart';
12 import 'package:stack_trace/stack_trace.dart'; 12 import 'package:stack_trace/stack_trace.dart';
13 13
14 import 'package:unittest/src/console_reporter.dart'; 14 import 'package:unittest/src/console_reporter.dart';
15 import 'package:unittest/src/exit_codes.dart' as exit_codes; 15 import 'package:unittest/src/exit_codes.dart' as exit_codes;
16 import 'package:unittest/src/io.dart';
16 import 'package:unittest/src/load_exception.dart'; 17 import 'package:unittest/src/load_exception.dart';
17 import 'package:unittest/src/loader.dart'; 18 import 'package:unittest/src/loader.dart';
18 import 'package:unittest/src/utils.dart'; 19 import 'package:unittest/src/utils.dart';
19 20
20 /// The argument parser used to parse the executable arguments. 21 /// The argument parser used to parse the executable arguments.
21 final _parser = new ArgParser(); 22 final _parser = new ArgParser();
22 23
23 void main(List<String> args) { 24 void main(List<String> args) {
24 _parser.addFlag("help", abbr: "h", negatable: false, 25 _parser.addFlag("help", abbr: "h", negatable: false,
25 help: "Shows this usage information."); 26 help: "Shows this usage information.");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 : exit_codes.data; 79 : exit_codes.data;
79 } else { 80 } else {
80 stderr.writeln(getErrorMessage(error)); 81 stderr.writeln(getErrorMessage(error));
81 stderr.writeln(new Trace.from(stackTrace).terse); 82 stderr.writeln(new Trace.from(stackTrace).terse);
82 stderr.writeln( 83 stderr.writeln(
83 "This is an unexpected error. Please file an issue at " 84 "This is an unexpected error. Please file an issue at "
84 "http://github.com/dart-lang/unittest\n" 85 "http://github.com/dart-lang/unittest\n"
85 "with the stack trace and instructions for reproducing the error."); 86 "with the stack trace and instructions for reproducing the error.");
86 exitCode = exit_codes.software; 87 exitCode = exit_codes.software;
87 } 88 }
88 }).whenComplete(() => loader.close()); 89 }).whenComplete(() {
90 return loader.close().then((_) {
91 // If we're on a Dart version that doesn't support Isolate.kill(), we have
92 // to manually exit so that dangling isolates don't prevent it.
93 if (!supportsIsolateKill) exit(exitCode);
94 });
95 });
89 } 96 }
90 97
91 /// Print usage information for this command. 98 /// Print usage information for this command.
92 /// 99 ///
93 /// If [error] is passed, it's used in place of the usage message and the whole 100 /// If [error] is passed, it's used in place of the usage message and the whole
94 /// thing is printed to stderr instead of stdout. 101 /// thing is printed to stderr instead of stdout.
95 void _printUsage([String error]) { 102 void _printUsage([String error]) {
96 var output = stdout; 103 var output = stdout;
97 104
98 var message = "Runs tests in this package."; 105 var message = "Runs tests in this package.";
99 if (error != null) { 106 if (error != null) {
100 message = error; 107 message = error;
101 output = stderr; 108 output = stderr;
102 } 109 }
103 110
104 output.write("""$message 111 output.write("""$message
105 112
106 Usage: pub run unittest:unittest [files or directories...] 113 Usage: pub run unittest:unittest [files or directories...]
107 114
108 ${_parser.usage} 115 ${_parser.usage}
109 """); 116 """);
110 } 117 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698