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:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 var phantomJS = new PhantomJS( | 147 var phantomJS = new PhantomJS( |
148 baseUrlForAddress(server.address, server.port)); | 148 baseUrlForAddress(server.address, server.port)); |
149 return phantomJS.close().whenComplete(server.close); | 149 return phantomJS.close().whenComplete(server.close); |
150 }); | 150 }); |
151 }); | 151 }); |
152 | 152 |
153 test("reports an error in onExit", () { | 153 test("reports an error in onExit", () { |
154 var phantomJS = new PhantomJS("http://dart-lang.org", | 154 var phantomJS = new PhantomJS("http://dart-lang.org", |
155 executable: "_does_not_exist"); | 155 executable: "_does_not_exist"); |
156 expect(phantomJS.onExit, throwsA(isApplicationException(startsWith( | 156 expect(phantomJS.onExit, throwsA(isApplicationException(startsWith( |
157 "Failed to start PhantomJS: No such file or directory")))); | 157 "Failed to start PhantomJS: $noSuchFileMessage")))); |
158 }); | 158 }); |
159 | 159 |
160 test("can run successful tests", () { | 160 test("can run successful tests", () { |
161 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" | 161 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" |
162 import 'package:test/test.dart'; | 162 import 'package:test/test.dart'; |
163 | 163 |
164 void main() { | 164 void main() { |
165 test("success", () {}); | 165 test("success", () {}); |
166 } | 166 } |
167 """); | 167 """); |
(...skipping 11 matching lines...) Expand all Loading... |
179 } | 179 } |
180 """); | 180 """); |
181 | 181 |
182 var result = _runTest(["-p", "phantomjs", "test.dart"]); | 182 var result = _runTest(["-p", "phantomjs", "test.dart"]); |
183 expect(result.exitCode, equals(1)); | 183 expect(result.exitCode, equals(1)); |
184 }); | 184 }); |
185 } | 185 } |
186 | 186 |
187 ProcessResult _runTest(List<String> args) => | 187 ProcessResult _runTest(List<String> args) => |
188 runTest(args, workingDirectory: _sandbox); | 188 runTest(args, workingDirectory: _sandbox); |
OLD | NEW |