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

Side by Side Diff: test/runner/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 | « test/runner/parse_metadata_test.dart ('k') | no next file » | 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 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 }); 321 });
322 }); 322 });
323 323
324 test("runs tests even when a file fails to load", () { 324 test("runs tests even when a file fails to load", () {
325 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); 325 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
326 var result = _runUnittest(["test.dart", "nonexistent.dart"]); 326 var result = _runUnittest(["test.dart", "nonexistent.dart"]);
327 expect(result.stdout, contains("+1 -1: Some tests failed.")); 327 expect(result.stdout, contains("+1 -1: Some tests failed."));
328 expect(result.exitCode, equals(1)); 328 expect(result.exitCode, equals(1));
329 }); 329 });
330 330
331 test("respects top-level @Timeout declarations", () {
332 new File(p.join(_sandbox, "test.dart")).writeAsStringSync('''
333 @Timeout(const Duration(seconds: 0))
334
335 import 'dart:async';
336
337 import 'package:test/test.dart';
338
339 void main() {
340 test("timeout", () {});
341 }
342 ''');
343
344 var result = _runUnittest(["test.dart"]);
345 expect(result.stdout, contains("Test timed out after 0 seconds."));
346 expect(result.stdout, contains("-1: Some tests failed."));
347 });
348
331 group("flags:", () { 349 group("flags:", () {
332 test("with the --color flag, uses colors", () { 350 test("with the --color flag, uses colors", () {
333 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); 351 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
334 var result = _runUnittest(["--color", "test.dart"]); 352 var result = _runUnittest(["--color", "test.dart"]);
335 // This is the color code for red. 353 // This is the color code for red.
336 expect(result.stdout, contains("\u001b[31m")); 354 expect(result.stdout, contains("\u001b[31m"));
337 }); 355 });
338 356
339 group("with the --name flag,", () { 357 group("with the --name flag,", () {
340 test("selects tests with matching names", () { 358 test("selects tests with matching names", () {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 }); 457 });
440 }); 458 });
441 }); 459 });
442 } 460 }
443 461
444 ProcessResult _runUnittest(List<String> args) => 462 ProcessResult _runUnittest(List<String> args) =>
445 runUnittest(args, workingDirectory: _sandbox); 463 runUnittest(args, workingDirectory: _sandbox);
446 464
447 ProcessResult _runDart(List<String> args) => 465 ProcessResult _runDart(List<String> args) =>
448 runDart(args, workingDirectory: _sandbox); 466 runDart(args, workingDirectory: _sandbox);
OLDNEW
« no previous file with comments | « test/runner/parse_metadata_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698