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

Side by Side Diff: lib/metatest.dart

Issue 1388213003: pkg/metatest: fix for latest pkg/test (Closed) Base URL: https://github.com/dart-lang/metatest@master
Patch Set: Created 5 years, 2 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// A test library for testing test libraries? We must go deeper. 5 /// A test library for testing test libraries? We must go deeper.
6 /// 6 ///
7 /// Since unit testing code tends to use a lot of global state, it can be tough 7 /// Since unit testing code tends to use a lot of global state, it can be tough
8 /// to test. This library manages it by running each test case in a child 8 /// to test. This library manages it by running each test case in a child
9 /// isolate, then reporting the results back to the parent isolate. 9 /// isolate, then reporting the results back to the parent isolate.
10 library metatest; 10 library metatest;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 /// Sets up a test with the given [description] and [body]. After the test runs, 65 /// Sets up a test with the given [description] and [body]. After the test runs,
66 /// calls [validate] with the result map. 66 /// calls [validate] with the result map.
67 void _setUpTest(String description, void body(), 67 void _setUpTest(String description, void body(),
68 void validate(List<LiveTest> liveTests), {String testOn, Timeout timeout, 68 void validate(List<LiveTest> liveTests), {String testOn, Timeout timeout,
69 skip, Map<String, dynamic> onPlatform}) { 69 skip, Map<String, dynamic> onPlatform}) {
70 test(description, () async { 70 test(description, () async {
71 var declarer = new Declarer(); 71 var declarer = new Declarer();
72 runZoned(body, zoneValues: {#test.declarer: declarer}); 72 runZoned(body, zoneValues: {#test.declarer: declarer});
73 73
74 var engine = new Engine.withSuites([ 74 var engine = new Engine.withSuites([
75 new RunnerSuite(new VMEnvironment(), declarer.tests) 75 new RunnerSuite(new VMEnvironment(), declarer.build())
76 ]); 76 ]);
77 for (var test in engine.liveTests) { 77 for (var test in engine.liveTests) {
78 test.onPrint.listen(print); 78 test.onPrint.listen(print);
79 } 79 }
80 await engine.run(); 80 await engine.run();
81 81
82 validate(engine.liveTests); 82 validate(engine.liveTests);
83 }, testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform); 83 }, testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform);
84 } 84 }
85 85
86 /// Returns a string description of the test run descibed by [liveTests]. 86 /// Returns a string description of the test run descibed by [liveTests].
87 String _summarizeTests(List<LiveTest> liveTests) { 87 String _summarizeTests(List<LiveTest> liveTests) {
88 var buffer = new StringBuffer(); 88 var buffer = new StringBuffer();
89 for (var liveTest in liveTests) { 89 for (var liveTest in liveTests) {
90 buffer.writeln("${liveTest.state.result}: ${liveTest.test.name}"); 90 buffer.writeln("${liveTest.state.result}: ${liveTest.test.name}");
91 for (var error in liveTest.errors) { 91 for (var error in liveTest.errors) {
92 buffer.writeln(error.error); 92 buffer.writeln(error.error);
93 if (error.stackTrace != null) buffer.writeln(error.stackTrace); 93 if (error.stackTrace != null) buffer.writeln(error.stackTrace);
94 } 94 }
95 } 95 }
96 return buffer.toString(); 96 return buffer.toString();
97 } 97 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698