| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 runtime.coverage; | 5 library runtime.coverage; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:args/args.dart' show ArgParser, ArgResults; | 9 import 'package:args/args.dart'; |
| 10 | 10 |
| 11 import 'package:analyzer_experimental/src/services/runtime/log.dart' as log; | 11 import 'package:analyzer_experimental/src/services/runtime/log.dart' as log; |
| 12 import 'package:analyzer_experimental/src/services/runtime/coverage/coverage_imp
l.dart'; | 12 import 'package:analyzer_experimental/src/services/runtime/coverage/coverage_imp
l.dart'; |
| 13 | 13 |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 ArgResults options; | 16 ArgResults options; |
| 17 try { | 17 try { |
| 18 options = _argParser.parse(new Options().arguments); | 18 options = _argParser.parse(new Options().arguments); |
| 19 } on FormatException catch (e) { | 19 } on FormatException catch (e) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 allowed: ['method', 'block', 'statement'], | 71 allowed: ['method', 'block', 'statement'], |
| 72 defaultsTo: 'statement') | 72 defaultsTo: 'statement') |
| 73 ..addOption('out', help: 'The output file with statistics.') | 73 ..addOption('out', help: 'The output file with statistics.') |
| 74 ..addOption( | 74 ..addOption( |
| 75 'port', | 75 'port', |
| 76 help: 'The port to run server on, if 0 select any.', | 76 help: 'The port to run server on, if 0 select any.', |
| 77 defaultsTo: '0'); | 77 defaultsTo: '0'); |
| 78 | 78 |
| 79 | 79 |
| 80 printUsage([var description = 'Code coverage tool for Dart.']) { | 80 printUsage([var description = 'Code coverage tool for Dart.']) { |
| 81 var buffer = new StringBuffer(); | |
| 82 var usage = _argParser.getUsage(); | 81 var usage = _argParser.getUsage(); |
| 83 buffer.write( | 82 print('$description\n'); |
| 84 '$description\n\n' | 83 print('Usage: coverage [options] <script>\n'); |
| 85 'Usage: coverage [options] <script>\n\n' | 84 print('$usage\n'); |
| 86 '$usage\n\n'); | |
| 87 print(buffer.toString()); | |
| 88 } | 85 } |
| 89 | 86 |
| 90 | 87 |
| 91 /// General error code. | 88 /// General error code. |
| 92 const ERROR = 1; | 89 const ERROR = 1; |
| OLD | NEW |