| OLD | NEW |
| 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 Loading... |
| 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); |
| OLD | NEW |