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

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

Issue 1044953004: Gracefully handle tests that print. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: 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/backend/invoker_test.dart ('k') | test/runner/compact_reporter_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:unittest/src/util/exit_codes.dart' as exit_codes; 10 import 'package:unittest/src/util/exit_codes.dart' as exit_codes;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void main() { 150 void main() {
151 test("test", () { 151 test("test", () {
152 if (p.style != p.Style.url) throw new TestFailure("oh no"); 152 if (p.style != p.Style.url) throw new TestFailure("oh no");
153 }); 153 });
154 } 154 }
155 """); 155 """);
156 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); 156 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]);
157 expect(result.exitCode, equals(1)); 157 expect(result.exitCode, equals(1));
158 }); 158 });
159 }); 159 });
160
161 test("forwards prints from the browser test", () {
162 new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
163 import 'dart:async';
164
165 import 'package:unittest/unittest.dart';
166
167 void main() {
168 test("test", () {
169 print("Hello,");
170 return new Future(() => print("world!"));
171 });
172 }
173 """);
174
175 var result = _runUnittest(["-p", "chrome", "test.dart"]);
176 expect(result.stdout, contains("Hello,\nworld!\n"));
177 expect(result.exitCode, equals(0));
178 });
160 } 179 }
161 180
162 ProcessResult _runUnittest(List<String> args) => 181 ProcessResult _runUnittest(List<String> args) =>
163 runUnittest(args, workingDirectory: _sandbox); 182 runUnittest(args, workingDirectory: _sandbox);
OLDNEW
« no previous file with comments | « test/backend/invoker_test.dart ('k') | test/runner/compact_reporter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698