OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Process test program to test process communication. | 5 // Process test program to test process communication. |
6 | 6 |
7 #import("dart:io"); | 7 #import("dart:io"); |
8 | 8 |
9 class ProcessStartExceptionTest { | 9 class ProcessStartExceptionTest { |
10 | 10 |
11 static void testStartError() { | 11 static void testStartError() { |
12 Process process = | 12 Process process = |
13 new Process.start("__path_to_something_that_should_not_exist__", | 13 new Process.start("__path_to_something_that_should_not_exist__", |
14 const []); | 14 const []); |
15 | 15 |
16 process.exitHandler = (int exitCode) { | 16 process.onExit = (int exitCode) { |
17 Expect.fail("exit handler called"); | 17 Expect.fail("exit handler called"); |
18 }; | 18 }; |
19 | 19 |
20 process.errorHandler = (ProcessException e) { | 20 process.onError = (ProcessException e) { |
21 Expect.equals(2, e.errorCode); | 21 Expect.equals(2, e.errorCode); |
22 }; | 22 }; |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 main() { | 26 main() { |
27 ProcessStartExceptionTest.testStartError(); | 27 ProcessStartExceptionTest.testStartError(); |
28 } | 28 } |
OLD | NEW |