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

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

Issue 2693893002: Add a new kind of suite to ease test.dart integration. (Closed)
Patch Set: Fix Linux and Windows paths. Created 3 years, 10 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 | « pkg/testing/lib/src/chain.dart ('k') | pkg/testing/lib/src/stdio_process.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) 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; 5 library testing.run;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Future, 8 Future,
9 Stream; 9 Stream;
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 import 'log.dart' show 42 import 'log.dart' show
43 isVerbose, 43 isVerbose,
44 logMessage, 44 logMessage,
45 logNumberedLines, 45 logNumberedLines,
46 splitLines; 46 splitLines;
47 47
48 import 'suite.dart' show 48 import 'suite.dart' show
49 Dart, 49 Dart,
50 Suite; 50 Suite;
51 51
52 import 'test_dart.dart' show
53 TestDart;
54
52 import 'zone_helper.dart' show 55 import 'zone_helper.dart' show
53 acknowledgeControlMessages; 56 acknowledgeControlMessages;
54 57
55 Future<TestRoot> computeTestRoot(String configurationPath, Uri base) { 58 Future<TestRoot> computeTestRoot(String configurationPath, Uri base) {
56 Uri configuration = configurationPath == null 59 Uri configuration = configurationPath == null
57 ? Uri.base.resolve("testing.json") 60 ? Uri.base.resolve("testing.json")
58 : base.resolve(configurationPath); 61 : base.resolve(configurationPath);
59 return TestRoot.fromUri(configuration); 62 return TestRoot.fromUri(configuration);
60 } 63 }
61 64
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 description.writeImportOn(imports); 175 description.writeImportOn(imports);
173 description.writeClosureOn(dart); 176 description.writeClosureOn(dart);
174 } 177 }
175 178
176 for (Chain suite in suites.where((Suite suite) => suite is Chain)) { 179 for (Chain suite in suites.where((Suite suite) => suite is Chain)) {
177 testUris.add(await Isolate.resolvePackageUri(suite.source)); 180 testUris.add(await Isolate.resolvePackageUri(suite.source));
178 suite.writeImportOn(imports); 181 suite.writeImportOn(imports);
179 suite.writeClosureOn(chain); 182 suite.writeClosureOn(chain);
180 } 183 }
181 184
182 if (testUris.isEmpty) return null; 185 bool hasTestDartSuite = false;
186 for (TestDart suite in suites.where((Suite suite) => suite is TestDart)) {
187 if (!hasTestDartSuite) {
188 suite.writeFirstImportOn(imports);
189 }
190 hasTestDartSuite = true;
191 suite.writeRunCommandOn(chain);
192 }
193
194 if (testUris.isEmpty && !hasTestDartSuite) return null;
183 195
184 return """ 196 return """
185 library testing.generated; 197 library testing.generated;
186 198
187 import 'dart:async' show Future; 199 import 'dart:async' show Future;
188 200
189 import 'dart:convert' show JSON; 201 import 'dart:convert' show JSON;
190 202
191 import 'package:testing/src/run_tests.dart' show runTests; 203 import 'package:testing/src/run_tests.dart' show runTests;
192 204
(...skipping 27 matching lines...) Expand all
220 listTests(<Uri>[suite.uri], pattern: "")) { 232 listTests(<Uri>[suite.uri], pattern: "")) {
221 String path = description.file.uri.path; 233 String path = description.file.uri.path;
222 if (suite.exclude.any((RegExp r) => path.contains(r))) continue; 234 if (suite.exclude.any((RegExp r) => path.contains(r))) continue;
223 if (suite.pattern.any((RegExp r) => path.contains(r))) { 235 if (suite.pattern.any((RegExp r) => path.contains(r))) {
224 yield description; 236 yield description;
225 } 237 }
226 } 238 }
227 } 239 }
228 } 240 }
229 } 241 }
OLDNEW
« no previous file with comments | « pkg/testing/lib/src/chain.dart ('k') | pkg/testing/lib/src/stdio_process.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698