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

Side by Side Diff: pkg/testing/lib/src/run_tests.dart

Issue 2622383003: Add general method for comma separated options. (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library testing.run_tests; 5 library testing.run_tests;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Future; 8 Future;
9 9
10 import 'dart:io' show 10 import 'dart:io' show
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 Suite; 42 Suite;
43 43
44 class CommandLine { 44 class CommandLine {
45 final Set<String> options; 45 final Set<String> options;
46 final List<String> arguments; 46 final List<String> arguments;
47 47
48 CommandLine(this.options, this.arguments); 48 CommandLine(this.options, this.arguments);
49 49
50 bool get verbose => options.contains("--verbose") || options.contains("-v"); 50 bool get verbose => options.contains("--verbose") || options.contains("-v");
51 51
52 Set<String> get skip { 52 Set<String> get skip => commaSeparated("--skip=");
53
54 Set<String> commaSeparated(String prefix) {
53 return options.expand((String s) { 55 return options.expand((String s) {
54 const String prefix = "--skip=";
55 if (!s.startsWith(prefix)) return const []; 56 if (!s.startsWith(prefix)) return const [];
56 s = s.substring(prefix.length); 57 s = s.substring(prefix.length);
57 return s.split(","); 58 return s.split(",");
58 }).toSet(); 59 }).toSet();
59 } 60 }
60 61
61 Map<String, String> get environment { 62 Map<String, String> get environment {
62 Map<String, String> result = <String, String>{}; 63 Map<String, String> result = <String, String>{};
63 for (String option in options) { 64 for (String option in options) {
64 if (option.startsWith("-D")) { 65 if (option.startsWith("-D")) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 }, printLineOnStdout: sb.writeln); 197 }, printLineOnStdout: sb.writeln);
197 logMessage(sb); 198 logMessage(sb);
198 } catch (e) { 199 } catch (e) {
199 print(sb); 200 print(sb);
200 rethrow; 201 rethrow;
201 } 202 }
202 logTestComplete(++completed, 0, tests.length, null, null); 203 logTestComplete(++completed, 0, tests.length, null, null);
203 } 204 }
204 logSuiteComplete(); 205 logSuiteComplete();
205 }); 206 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698