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

Side by Side Diff: test/backend/invoker_test.dart

Issue 2091173002: Add metadata to messages emitted by live tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 6 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 | « lib/src/runner/runner_test.dart ('k') | test/runner/browser/loader_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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:fake_async/fake_async.dart'; 7 import 'package:fake_async/fake_async.dart';
8 import 'package:test/src/backend/group.dart'; 8 import 'package:test/src/backend/group.dart';
9 import 'package:test/src/backend/invoker.dart'; 9 import 'package:test/src/backend/invoker.dart';
10 import 'package:test/src/backend/message.dart';
10 import 'package:test/src/backend/metadata.dart'; 11 import 'package:test/src/backend/metadata.dart';
11 import 'package:test/src/backend/state.dart'; 12 import 'package:test/src/backend/state.dart';
12 import 'package:test/src/backend/suite.dart'; 13 import 'package:test/src/backend/suite.dart';
13 import 'package:test/test.dart'; 14 import 'package:test/test.dart';
14 15
15 import '../utils.dart'; 16 import '../utils.dart';
16 17
17 void main() { 18 void main() {
18 var suite; 19 var suite;
19 setUp(() { 20 setUp(() {
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 expect(outstandingCallbackRemoved, isTrue); 374 expect(outstandingCallbackRemoved, isTrue);
374 }); 375 });
375 376
376 test("a test's prints are captured and reported", () { 377 test("a test's prints are captured and reported", () {
377 expect(() { 378 expect(() {
378 var liveTest = _localTest(() { 379 var liveTest = _localTest(() {
379 print("Hello,"); 380 print("Hello,");
380 return new Future(() => print("world!")); 381 return new Future(() => print("world!"));
381 }).load(suite); 382 }).load(suite);
382 383
383 expect(liveTest.onPrint.take(2).toList(), 384 expect(liveTest.onMessage.take(2).toList().then((messages) {
384 completion(equals(["Hello,", "world!"]))); 385 expect(messages[0].type, equals(MessageType.print));
386 expect(messages[0].text, equals("Hello,"));
387 expect(messages[1].type, equals(MessageType.print));
388 expect(messages[1].text, equals("world!"));
389 }), completes);
385 390
386 return liveTest.run(); 391 return liveTest.run();
387 }, prints(isEmpty)); 392 }, prints(isEmpty));
388 }); 393 });
389 394
390 group("timeout:", () { 395 group("timeout:", () {
391 test("a test times out after 30 seconds by default", () { 396 test("a test times out after 30 seconds by default", () {
392 new FakeAsync().run((async) { 397 new FakeAsync().run((async) {
393 var liveTest = _localTest(() { 398 var liveTest = _localTest(() {
394 Invoker.current.addOutstandingCallback(); 399 Invoker.current.addOutstandingCallback();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 expect(liveTest.state.status, equals(Status.complete)); 528 expect(liveTest.state.status, equals(Status.complete));
524 expect(isComplete, isFalse); 529 expect(isComplete, isFalse);
525 }); 530 });
526 }); 531 });
527 } 532 }
528 533
529 LocalTest _localTest(body(), {Metadata metadata}) { 534 LocalTest _localTest(body(), {Metadata metadata}) {
530 if (metadata == null) metadata = new Metadata(); 535 if (metadata == null) metadata = new Metadata();
531 return new LocalTest("test", metadata, body); 536 return new LocalTest("test", metadata, body);
532 } 537 }
OLDNEW
« no previous file with comments | « lib/src/runner/runner_test.dart ('k') | test/runner/browser/loader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698