OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub | 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub |
6 /// tests are integration tests that stage some stuff on the file system, run | 6 /// tests are integration tests that stage some stuff on the file system, run |
7 /// pub, and then validate the results. This library provides an API to build | 7 /// pub, and then validate the results. This library provides an API to build |
8 /// tests like that. | 8 /// tests like that. |
9 library test_pub; | 9 library test_pub; |
10 | 10 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void solo_integration(String description, void body()) => | 225 void solo_integration(String description, void body()) => |
226 _integration(description, body, solo_test); | 226 _integration(description, body, solo_test); |
227 | 227 |
228 void _integration(String description, void body(), [Function testFn]) { | 228 void _integration(String description, void body(), [Function testFn]) { |
229 testFn(description, () { | 229 testFn(description, () { |
230 // The windows bots are very slow, so we increase the default timeout. | 230 // The windows bots are very slow, so we increase the default timeout. |
231 if (Platform.operatingSystem == "windows") { | 231 if (Platform.operatingSystem == "windows") { |
232 currentSchedule.timeout = new Duration(seconds: 10); | 232 currentSchedule.timeout = new Duration(seconds: 10); |
233 } | 233 } |
234 | 234 |
| 235 // By default, don't capture stack traces since they slow the tests way |
| 236 // down. To debug failing tests, comment this out. |
| 237 currentSchedule.captureStackTraces = |
| 238 new Options().arguments.contains('--trace'); |
| 239 |
235 // Ensure the SDK version is always available. | 240 // Ensure the SDK version is always available. |
236 d.dir(sdkPath, [ | 241 d.dir(sdkPath, [ |
237 d.file('version', '0.1.2.3') | 242 d.file('version', '0.1.2.3') |
238 ]).create(); | 243 ]).create(); |
239 | 244 |
240 _sandboxDir = createTempDir(); | 245 _sandboxDir = createTempDir(); |
241 d.defaultRoot = sandboxDir; | 246 d.defaultRoot = sandboxDir; |
242 currentSchedule.onComplete.schedule(() => deleteEntry(_sandboxDir), | 247 currentSchedule.onComplete.schedule(() => deleteEntry(_sandboxDir), |
243 'deleting the sandbox directory'); | 248 'deleting the sandbox directory'); |
244 | 249 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 bool matches(item, MatchState matchState) { | 610 bool matches(item, MatchState matchState) { |
606 if (item is! Pair) return false; | 611 if (item is! Pair) return false; |
607 return _firstMatcher.matches(item.first, matchState) && | 612 return _firstMatcher.matches(item.first, matchState) && |
608 _lastMatcher.matches(item.last, matchState); | 613 _lastMatcher.matches(item.last, matchState); |
609 } | 614 } |
610 | 615 |
611 Description describe(Description description) { | 616 Description describe(Description description) { |
612 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 617 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
613 } | 618 } |
614 } | 619 } |
OLD | NEW |