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

Side by Side Diff: test/runner/browser/runner_test.dart

Issue 1086213002: Support a @Timeout annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: CHANGELOG + README Created 5 years, 8 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 | « pubspec.yaml ('k') | test/runner/isolate_listener_test.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) 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
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);
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/runner/isolate_listener_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698