OLD | NEW |
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 library test.executable; | 8 library test.executable; |
9 | 9 |
10 import 'dart:async'; | 10 import 'dart:async'; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (new Directory(path).existsSync()) return loader.loadDir(path); | 188 if (new Directory(path).existsSync()) return loader.loadDir(path); |
189 if (new File(path).existsSync()) return loader.loadFile(path); | 189 if (new File(path).existsSync()) return loader.loadFile(path); |
190 return new Stream.fromFuture(new Future.error( | 190 return new Stream.fromFuture(new Future.error( |
191 new LoadException(path, 'Does not exist.'), | 191 new LoadException(path, 'Does not exist.'), |
192 new Trace.current())); | 192 new Trace.current())); |
193 })).transform(new StreamTransformer.fromHandlers( | 193 })).transform(new StreamTransformer.fromHandlers( |
194 handleError: (error, stackTrace, sink) { | 194 handleError: (error, stackTrace, sink) { |
195 if (error is! LoadException) { | 195 if (error is! LoadException) { |
196 sink.addError(error, stackTrace); | 196 sink.addError(error, stackTrace); |
197 } else { | 197 } else { |
198 sink.add(new LoadExceptionSuite(error)); | 198 sink.add(new LoadExceptionSuite(error, stackTrace)); |
199 } | 199 } |
200 })).toList().then((suites) { | 200 })).toList().then((suites) { |
201 if (closed) return null; | 201 if (closed) return null; |
202 suites = flatten(suites); | 202 suites = flatten(suites); |
203 | 203 |
204 var pattern; | 204 var pattern; |
205 if (options["name"] != null) { | 205 if (options["name"] != null) { |
206 if (options["plain-name"] != null) { | 206 if (options["plain-name"] != null) { |
207 _printUsage("--name and --plain-name may not both be passed."); | 207 _printUsage("--name and --plain-name may not both be passed."); |
208 exitCode = exit_codes.data; | 208 exitCode = exit_codes.data; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 if (description is! Map) return false; | 356 if (description is! Map) return false; |
357 var path = description["path"]; | 357 var path = description["path"]; |
358 if (path is! String) return false; | 358 if (path is! String) return false; |
359 | 359 |
360 print("$version (from $path)"); | 360 print("$version (from $path)"); |
361 return true; | 361 return true; |
362 | 362 |
363 default: return false; | 363 default: return false; |
364 } | 364 } |
365 } | 365 } |
OLD | NEW |