OLD | NEW |
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 /** | 5 /** |
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub | 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub |
7 * tests are integration tests that stage some stuff on the file system, run | 7 * tests are integration tests that stage some stuff on the file system, run |
8 * pub, and then validate the results. This library provides an API to build | 8 * pub, and then validate the results. This library provides an API to build |
9 * tests like that. | 9 * tests like that. |
10 */ | 10 */ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // No app directory. | 104 // No app directory. |
105 if (app == null) return new Future.immediate(null); | 105 if (app == null) return new Future.immediate(null); |
106 | 106 |
107 return app.create(sandboxDir); | 107 return app.create(sandboxDir); |
108 } | 108 } |
109 | 109 |
110 Future<ProcessResult> _runPub(List<String> pubArgs, String workingDir) { | 110 Future<ProcessResult> _runPub(List<String> pubArgs, String workingDir) { |
111 // Find a dart executable we can use to run pub. Uses the one that the | 111 // Find a dart executable we can use to run pub. Uses the one that the |
112 // test infrastructure uses. | 112 // test infrastructure uses. |
113 final scriptDir = new File(new Options().script).directorySync().path; | 113 final scriptDir = new File(new Options().script).directorySync().path; |
114 final platform = Platform.operatingSystem(); | 114 final platform = Platform.operatingSystem; |
115 final dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart'); | 115 final dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart'); |
116 | 116 |
117 // Find the main pub entrypoint. | 117 // Find the main pub entrypoint. |
118 final pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart'); | 118 final pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart'); |
119 | 119 |
120 final args = ['--enable-type-checks', '--enable-asserts', pubPath]; | 120 final args = ['--enable-type-checks', '--enable-asserts', pubPath]; |
121 args.addAll(pubArgs); | 121 args.addAll(pubArgs); |
122 | 122 |
123 return runProcess(dartBin, args, workingDir); | 123 return runProcess(dartBin, args, workingDir); |
124 } | 124 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 return Futures.wait(entryFutures).transform((entries) { | 299 return Futures.wait(entryFutures).transform((entries) { |
300 for (final entry in entries) { | 300 for (final entry in entries) { |
301 if (entry != null) return entry; | 301 if (entry != null) return entry; |
302 } | 302 } |
303 | 303 |
304 // If we got here, all of the sub-entries were valid. | 304 // If we got here, all of the sub-entries were valid. |
305 return null; | 305 return null; |
306 }); | 306 }); |
307 } | 307 } |
308 } | 308 } |
OLD | NEW |