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

Side by Side Diff: example/test_runner.dart

Issue 849023002: format code, removed unused variables and deprecated usage (Closed) Base URL: https://github.com/dart-lang/args.git@master
Patch Set: nits Created 5 years, 11 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 | « CHANGELOG.md ('k') | lib/command_runner.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) 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', abbr: 'm', defaultsTo: 'debug', 17 parser.addOption('mode',
18 abbr: 'm',
19 defaultsTo: 'debug',
18 help: 'Mode in which to run the tests', 20 help: 'Mode in which to run the tests',
19 allowed: ['all', 'debug', 'release']); 21 allowed: ['all', 'debug', 'release']);
20 22
21 parser.addOption('compiler', abbr: 'c', defaultsTo: 'none', 23 parser.addOption('compiler',
24 abbr: 'c',
25 defaultsTo: 'none',
22 help: 'Specify any compilation step (if needed).', 26 help: 'Specify any compilation step (if needed).',
23 allowed: ['none', 'dart2js', 'dartc'], 27 allowed: ['none', 'dart2js', 'dartc'],
24 allowedHelp: { 28 allowedHelp: {
25 'none': 'Do not compile the Dart code (run native Dart code on the' 29 'none': 'Do not compile the Dart code (run native Dart code on the'
26 ' VM).\n(only valid with the following runtimes: vm, drt)', 30 ' VM).\n(only valid with the following runtimes: vm, drt)',
27 'dart2js': 'Compile dart code to JavaScript by running dart2js.\n' 31 'dart2js': 'Compile dart code to JavaScript by running dart2js.\n'
28 '(only valid with the following runtimes: d8, drt, chrome\n' 32 '(only valid with the following runtimes: d8, drt, chrome\n'
29 'safari, ie, firefox, opera, none (compile only))', 33 'safari, ie, firefox, opera, none (compile only))',
30 'dartc': 'Perform static analysis on Dart code by running dartc.\n' 34 'dartc': 'Perform static analysis on Dart code by running dartc.\n'
31 '(only valid with the following runtimes: none)', 35 '(only valid with the following runtimes: none)',
32 }); 36 });
33 37
34 parser.addOption('runtime', abbr: 'r', defaultsTo: 'vm', 38 parser.addOption('runtime',
39 abbr: 'r',
40 defaultsTo: 'vm',
35 help: 'Where the tests should be run.', 41 help: 'Where the tests should be run.',
36 allowed: ['vm', 'd8', 'drt', 'dartium', 'ff', 'firefox', 'chrome', 42 allowed: [
37 'safari', 'ie', 'opera', 'none'], 43 'vm',
44 'd8',
45 'drt',
46 'dartium',
47 'ff',
48 'firefox',
49 'chrome',
50 'safari',
51 'ie',
52 'opera',
53 'none'
54 ],
38 allowedHelp: { 55 allowedHelp: {
39 'vm': 'Run Dart code on the standalone dart vm.', 56 'vm': 'Run Dart code on the standalone dart vm.',
40 'd8': 'Run JavaScript from the command line using v8.', 57 'd8': 'Run JavaScript from the command line using v8.',
41 // TODO(antonm): rename flag. 58 // TODO(antonm): rename flag.
42 'drt': 'Run Dart or JavaScript in the headless version of Chrome,\n' 59 'drt': 'Run Dart or JavaScript in the headless version of Chrome,\n'
43 'content shell.', 60 'content shell.',
44 'dartium': 'Run Dart or JavaScript in Dartium.', 61 'dartium': 'Run Dart or JavaScript in Dartium.',
45 'ff': 'Run JavaScript in Firefox', 62 'ff': 'Run JavaScript in Firefox',
46 'chrome': 'Run JavaScript in Chrome', 63 'chrome': 'Run JavaScript in Chrome',
47 'safari': 'Run JavaScript in Safari', 64 'safari': 'Run JavaScript in Safari',
48 'ie': 'Run JavaScript in Internet Explorer', 65 'ie': 'Run JavaScript in Internet Explorer',
49 'opera': 'Run JavaScript in Opera', 66 'opera': 'Run JavaScript in Opera',
50 'none': 'No runtime, compile only (for example, used for dartc static\n' 67 'none': 'No runtime, compile only (for example, used for dartc static\n'
51 'analysis tests).', 68 'analysis tests).',
52 }); 69 });
53 70
54 parser.addOption('arch', abbr: 'a', defaultsTo: 'ia32', 71 parser.addOption('arch',
72 abbr: 'a',
73 defaultsTo: 'ia32',
55 help: 'The architecture to run tests for', 74 help: 'The architecture to run tests for',
56 allowed: ['all', 'ia32', 'x64', 'simarm']); 75 allowed: ['all', 'ia32', 'x64', 'simarm']);
57 76
58 parser.addOption('system', abbr: 's', defaultsTo: Platform.operatingSystem, 77 parser.addOption('system',
78 abbr: 's',
79 defaultsTo: Platform.operatingSystem,
59 help: 'The operating system to run tests on', 80 help: 'The operating system to run tests on',
60 allowed: ['linux', 'macos', 'windows']); 81 allowed: ['linux', 'macos', 'windows']);
61 82
62 parser.addFlag('checked', defaultsTo: false, 83 parser.addFlag('checked',
63 help: 'Run tests in checked mode'); 84 defaultsTo: false, help: 'Run tests in checked mode');
64 85
65 parser.addFlag('host-checked', defaultsTo: false, 86 parser.addFlag('host-checked',
66 help: 'Run compiler in checked mode'); 87 defaultsTo: false, help: 'Run compiler in checked mode');
67 88
68 parser.addOption('timeout', abbr: 't', 89 parser.addOption('timeout', abbr: 't', help: 'Timeout in seconds');
69 help: 'Timeout in seconds');
70 90
71 parser.addOption('progress', abbr: 'p', defaultsTo: 'compact', 91 parser.addOption('progress',
92 abbr: 'p',
93 defaultsTo: 'compact',
72 help: 'Progress indication mode', 94 help: 'Progress indication mode',
73 allowed: ['compact', 'color', 'line', 'verbose', 'silent', 'status', 95 allowed: [
74 'buildbot']); 96 'compact',
97 'color',
98 'line',
99 'verbose',
100 'silent',
101 'status',
102 'buildbot'
103 ]);
75 104
76 parser.addFlag('report', defaultsTo: false, 105 parser.addFlag('report',
106 defaultsTo: false,
77 help: 'Print a summary report of the number of tests, by expectation'); 107 help: 'Print a summary report of the number of tests, by expectation');
78 108
79 parser.addOption('tasks', abbr: 'j', 109 parser.addOption('tasks',
110 abbr: 'j',
80 defaultsTo: Platform.numberOfProcessors.toString(), 111 defaultsTo: Platform.numberOfProcessors.toString(),
81 help: 'The number of parallel tasks to run'); 112 help: 'The number of parallel tasks to run');
82 113
83 parser.addOption('shards', defaultsTo: '1', 114 parser.addOption('shards',
115 defaultsTo: '1',
84 help: 'The number of instances that the tests will be sharded over'); 116 help: 'The number of instances that the tests will be sharded over');
85 117
86 parser.addOption('shard', defaultsTo: '1', 118 parser.addOption('shard',
119 defaultsTo: '1',
87 help: 'The index of this instance when running in sharded mode'); 120 help: 'The index of this instance when running in sharded mode');
88 121
89 parser.addFlag('verbose', abbr: 'v', defaultsTo: false, 122 parser.addFlag('verbose',
90 help: 'Verbose output'); 123 abbr: 'v', defaultsTo: false, help: 'Verbose output');
91 124
92 parser.addFlag('list', defaultsTo: false, 125 parser.addFlag('list',
93 help: 'List tests only, do not run them'); 126 defaultsTo: false, help: 'List tests only, do not run them');
94 127
95 parser.addFlag('keep-generated-tests', defaultsTo: false, 128 parser.addFlag('keep-generated-tests',
129 defaultsTo: false,
96 help: 'Keep the generated files in the temporary directory'); 130 help: 'Keep the generated files in the temporary directory');
97 131
98 parser.addFlag('valgrind', defaultsTo: false, 132 parser.addFlag('valgrind',
99 help: 'Run tests through valgrind'); 133 defaultsTo: false, help: 'Run tests through valgrind');
100 134
101 parser.addOption('special-command', 135 parser.addOption('special-command', help: """
102 help: """
103 Special command support. Wraps the command line in 136 Special command support. Wraps the command line in
104 a special command. The special command should contain 137 a special command. The special command should contain
105 an '@' character which will be replaced by the normal 138 an '@' character which will be replaced by the normal
106 command. 139 command.
107 140
108 For example if the normal command that will be executed 141 For example if the normal command that will be executed
109 is 'dart file.dart' and you specify special command 142 is 'dart file.dart' and you specify special command
110 'python -u valgrind.py @ suffix' the final command will be 143 'python -u valgrind.py @ suffix' the final command will be
111 'python -u valgrind.py dart file.dart suffix'"""); 144 'python -u valgrind.py dart file.dart suffix'""");
112 145
113 parser.addFlag('time', 146 parser.addFlag('time',
114 help: 'Print timing information after running tests', 147 help: 'Print timing information after running tests', defaultsTo: false);
115 defaultsTo: false);
116 148
117 parser.addOption('dart', help: 'Path to dart executable'); 149 parser.addOption('dart', help: 'Path to dart executable');
118 parser.addOption('drt', help: 'Path to content shell executable'); 150 parser.addOption('drt', help: 'Path to content shell executable');
119 parser.addOption('dartium', help: 'Path to Dartium Chrome executable'); 151 parser.addOption('dartium', help: 'Path to Dartium Chrome executable');
120 152
121 parser.addFlag('batch', abbr: 'b', 153 parser.addFlag('batch',
122 help: 'Run browser tests in batch mode', 154 abbr: 'b', help: 'Run browser tests in batch mode', defaultsTo: true);
123 defaultsTo: true);
124 155
125 print(parser.getUsage()); 156 print(parser.usage);
126 } 157 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/command_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698