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

Side by Side Diff: example/test_runner.dart

Issue 1145413002: Add support for separators. (Closed) Base URL: git@github.com:dart-lang/args@master
Patch Set: Created 5 years, 7 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /// This is an example of converting the args in test.dart to use this API. 5 /// This is an example of converting the args in test.dart to use this API.
6 /// It shows what it looks like to build an [ArgParser] and then, when the code 6 /// It shows what it looks like to build an [ArgParser] and then, when the code
7 /// is run, demonstrates what the generated usage text looks like. 7 /// is run, demonstrates what the generated usage text looks like.
8 library example; 8 library example;
9 9
10 import 'dart:io'; 10 import 'dart:io';
11 11
12 import 'package:args/args.dart'; 12 import 'package:args/args.dart';
13 13
14 main() { 14 main() {
15 var parser = new ArgParser(); 15 var parser = new ArgParser();
16 16
17 parser.addOption('mode', 17 parser.addSeparator('===== Platform');
kevmoo 2015/05/21 02:44:27 Would it be worth while to just standardize on thi
nweiz 2015/05/21 19:22:27 I don't think so. It's really easy to add manually
18 abbr: 'm',
19 defaultsTo: 'debug',
20 help: 'Mode in which to run the tests',
21 allowed: ['all', 'debug', 'release']);
22 18
23 parser.addOption('compiler', 19 parser.addOption('compiler',
24 abbr: 'c', 20 abbr: 'c',
25 defaultsTo: 'none', 21 defaultsTo: 'none',
26 help: 'Specify any compilation step (if needed).', 22 help: 'Specify any compilation step (if needed).',
27 allowed: ['none', 'dart2js', 'dartc'], 23 allowed: ['none', 'dart2js', 'dartc'],
28 allowedHelp: { 24 allowedHelp: {
29 'none': 'Do not compile the Dart code (run native Dart code on the' 25 'none': 'Do not compile the Dart code (run native Dart code on the'
30 ' VM).\n(only valid with the following runtimes: vm, drt)', 26 ' VM).\n(only valid with the following runtimes: vm, drt)',
31 'dart2js': 'Compile dart code to JavaScript by running dart2js.\n' 27 'dart2js': 'Compile dart code to JavaScript by running dart2js.\n'
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 defaultsTo: 'ia32', 69 defaultsTo: 'ia32',
74 help: 'The architecture to run tests for', 70 help: 'The architecture to run tests for',
75 allowed: ['all', 'ia32', 'x64', 'simarm']); 71 allowed: ['all', 'ia32', 'x64', 'simarm']);
76 72
77 parser.addOption('system', 73 parser.addOption('system',
78 abbr: 's', 74 abbr: 's',
79 defaultsTo: Platform.operatingSystem, 75 defaultsTo: Platform.operatingSystem,
80 help: 'The operating system to run tests on', 76 help: 'The operating system to run tests on',
81 allowed: ['linux', 'macos', 'windows']); 77 allowed: ['linux', 'macos', 'windows']);
82 78
79 parser.addSeparator('===== Runtime');
80
81 parser.addOption('mode',
82 abbr: 'm',
83 defaultsTo: 'debug',
84 help: 'Mode in which to run the tests',
85 allowed: ['all', 'debug', 'release']);
86
83 parser.addFlag('checked', 87 parser.addFlag('checked',
84 defaultsTo: false, help: 'Run tests in checked mode'); 88 defaultsTo: false, help: 'Run tests in checked mode');
85 89
86 parser.addFlag('host-checked', 90 parser.addFlag('host-checked',
87 defaultsTo: false, help: 'Run compiler in checked mode'); 91 defaultsTo: false, help: 'Run compiler in checked mode');
88 92
89 parser.addOption('timeout', abbr: 't', help: 'Timeout in seconds'); 93 parser.addOption('timeout', abbr: 't', help: 'Timeout in seconds');
90 94
95 parser.addOption('tasks',
96 abbr: 'j',
97 defaultsTo: Platform.numberOfProcessors.toString(),
98 help: 'The number of parallel tasks to run');
99
100 parser.addOption('shards',
101 defaultsTo: '1',
102 help: 'The number of instances that the tests will be sharded over');
103
104 parser.addOption('shard',
105 defaultsTo: '1',
106 help: 'The index of this instance when running in sharded mode');
107
108 parser.addFlag('valgrind',
109 defaultsTo: false, help: 'Run tests through valgrind');
110
111 parser.addSeparator('===== Output');
112
91 parser.addOption('progress', 113 parser.addOption('progress',
92 abbr: 'p', 114 abbr: 'p',
93 defaultsTo: 'compact', 115 defaultsTo: 'compact',
94 help: 'Progress indication mode', 116 help: 'Progress indication mode',
95 allowed: [ 117 allowed: [
96 'compact', 118 'compact',
97 'color', 119 'color',
98 'line', 120 'line',
99 'verbose', 121 'verbose',
100 'silent', 122 'silent',
101 'status', 123 'status',
102 'buildbot' 124 'buildbot'
103 ]); 125 ]);
104 126
105 parser.addFlag('report', 127 parser.addFlag('report',
106 defaultsTo: false, 128 defaultsTo: false,
107 help: 'Print a summary report of the number of tests, by expectation'); 129 help: 'Print a summary report of the number of tests, by expectation');
108 130
109 parser.addOption('tasks',
110 abbr: 'j',
111 defaultsTo: Platform.numberOfProcessors.toString(),
112 help: 'The number of parallel tasks to run');
113
114 parser.addOption('shards',
115 defaultsTo: '1',
116 help: 'The number of instances that the tests will be sharded over');
117
118 parser.addOption('shard',
119 defaultsTo: '1',
120 help: 'The index of this instance when running in sharded mode');
121
122 parser.addFlag('verbose', 131 parser.addFlag('verbose',
123 abbr: 'v', defaultsTo: false, help: 'Verbose output'); 132 abbr: 'v', defaultsTo: false, help: 'Verbose output');
124 133
125 parser.addFlag('list', 134 parser.addFlag('list',
126 defaultsTo: false, help: 'List tests only, do not run them'); 135 defaultsTo: false, help: 'List tests only, do not run them');
127 136
137 parser.addFlag('time',
138 help: 'Print timing information after running tests', defaultsTo: false);
139
140 parser.addFlag('batch',
141 abbr: 'b', help: 'Run browser tests in batch mode', defaultsTo: true);
142
143 parser.addSeparator('===== Miscellaneous');
144
128 parser.addFlag('keep-generated-tests', 145 parser.addFlag('keep-generated-tests',
129 defaultsTo: false, 146 defaultsTo: false,
130 help: 'Keep the generated files in the temporary directory'); 147 help: 'Keep the generated files in the temporary directory');
131 148
132 parser.addFlag('valgrind',
133 defaultsTo: false, help: 'Run tests through valgrind');
134
135 parser.addOption('special-command', help: """ 149 parser.addOption('special-command', help: """
136 Special command support. Wraps the command line in 150 Special command support. Wraps the command line in
137 a special command. The special command should contain 151 a special command. The special command should contain
138 an '@' character which will be replaced by the normal 152 an '@' character which will be replaced by the normal
139 command. 153 command.
140 154
141 For example if the normal command that will be executed 155 For example if the normal command that will be executed
142 is 'dart file.dart' and you specify special command 156 is 'dart file.dart' and you specify special command
143 'python -u valgrind.py @ suffix' the final command will be 157 'python -u valgrind.py @ suffix' the final command will be
144 'python -u valgrind.py dart file.dart suffix'"""); 158 'python -u valgrind.py dart file.dart suffix'""");
145 159
146 parser.addFlag('time',
147 help: 'Print timing information after running tests', defaultsTo: false);
148
149 parser.addOption('dart', help: 'Path to dart executable'); 160 parser.addOption('dart', help: 'Path to dart executable');
150 parser.addOption('drt', help: 'Path to content shell executable'); 161 parser.addOption('drt', help: 'Path to content shell executable');
151 parser.addOption('dartium', help: 'Path to Dartium Chrome executable'); 162 parser.addOption('dartium', help: 'Path to Dartium Chrome executable');
152 163
153 parser.addFlag('batch',
154 abbr: 'b', help: 'Run browser tests in batch mode', defaultsTo: true);
155
156 print(parser.usage); 164 print(parser.usage);
157 } 165 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/arg_parser.dart » ('j') | lib/src/arg_parser.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698