OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 import 'package:test/src/util/io.dart'; | 10 import 'package:test/src/util/io.dart'; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 print("Hello,"); | 251 print("Hello,"); |
252 return new Future(() => print("world!")); | 252 return new Future(() => print("world!")); |
253 }); | 253 }); |
254 } | 254 } |
255 """); | 255 """); |
256 | 256 |
257 var result = _runUnittest(["-p", "chrome", "test.dart"]); | 257 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
258 expect(result.stdout, contains("Hello,\nworld!\n")); | 258 expect(result.stdout, contains("Hello,\nworld!\n")); |
259 expect(result.exitCode, equals(0)); | 259 expect(result.exitCode, equals(0)); |
260 }); | 260 }); |
| 261 |
| 262 test("respects top-level @Timeout declarations", () { |
| 263 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
| 264 @Timeout(const Duration(seconds: 0)) |
| 265 |
| 266 import 'dart:async'; |
| 267 |
| 268 import 'package:test/test.dart'; |
| 269 |
| 270 void main() { |
| 271 test("timeout", () {}); |
| 272 } |
| 273 '''); |
| 274 |
| 275 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
| 276 expect(result.stdout, contains("Test timed out after 0 seconds.")); |
| 277 expect(result.stdout, contains("-1: Some tests failed.")); |
| 278 }); |
261 } | 279 } |
262 | 280 |
263 ProcessResult _runUnittest(List<String> args) => | 281 ProcessResult _runUnittest(List<String> args) => |
264 runUnittest(args, workingDirectory: _sandbox); | 282 runUnittest(args, workingDirectory: _sandbox); |
OLD | NEW |