OLD | NEW |
1 // Copyright (c) 2012, 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 that invalid arguments throw exceptions. | 5 // Process test program to test that invalid arguments throw exceptions. |
6 | 6 |
7 #import("dart:io"); | 7 import "dart:io"; |
8 | 8 |
9 void main() { | 9 void main() { |
10 Expect.throws(() => Process.start(["true"], []), | 10 Expect.throws(() => Process.start(["true"], []), |
11 (e) => e is ArgumentError); | 11 (e) => e is ArgumentError); |
12 Expect.throws(() => Process.start("true", "asdf"), | 12 Expect.throws(() => Process.start("true", "asdf"), |
13 (e) => e is ArgumentError); | 13 (e) => e is ArgumentError); |
14 Expect.throws(() => Process.start("true", ["asdf", 1]), | 14 Expect.throws(() => Process.start("true", ["asdf", 1]), |
15 (e) => e is ArgumentError); | 15 (e) => e is ArgumentError); |
16 Expect.throws(() => Process.run(["true"], [], null), | 16 Expect.throws(() => Process.run(["true"], [], null), |
17 (e) => e is ArgumentError); | 17 (e) => e is ArgumentError); |
18 Expect.throws(() => Process.run("true", "asdf", null), | 18 Expect.throws(() => Process.run("true", "asdf", null), |
19 (e) => e is ArgumentError); | 19 (e) => e is ArgumentError); |
20 Expect.throws(() => Process.run("true", ["asdf", 1], null), | 20 Expect.throws(() => Process.run("true", ["asdf", 1], null), |
21 (e) => e is ArgumentError); | 21 (e) => e is ArgumentError); |
22 var options = new ProcessOptions(); | 22 var options = new ProcessOptions(); |
23 options.workingDirectory = 23; | 23 options.workingDirectory = 23; |
24 Expect.throws(() => Process.start("true", [], options), | 24 Expect.throws(() => Process.start("true", [], options), |
25 (e) => e is ArgumentError); | 25 (e) => e is ArgumentError); |
26 Expect.throws(() => Process.run("true", [], options), | 26 Expect.throws(() => Process.run("true", [], options), |
27 (e) => e is ArgumentError); | 27 (e) => e is ArgumentError); |
28 options = new ProcessOptions(); | 28 options = new ProcessOptions(); |
29 options.stdoutEncoding = 23; | 29 options.stdoutEncoding = 23; |
30 Expect.throws(() => Process.run("true", [], options), | 30 Expect.throws(() => Process.run("true", [], options), |
31 (e) => e is ArgumentError); | 31 (e) => e is ArgumentError); |
32 options = new ProcessOptions(); | 32 options = new ProcessOptions(); |
33 options.stderrEncoding = 23; | 33 options.stderrEncoding = 23; |
34 Expect.throws(() => Process.run("true", [], options), | 34 Expect.throws(() => Process.run("true", [], options), |
35 (e) => e is ArgumentError); | 35 (e) => e is ArgumentError); |
36 } | 36 } |
OLD | NEW |