| 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| 11 Expect.throws(() => Process.start(["true"], []), | 11 Expect.throws(() => Process.start(["true"], []), |
| 12 (e) => e is ArgumentError); | 12 (e) => e is ArgumentError); |
| 13 Expect.throws(() => Process.start("true", "asdf"), | 13 Expect.throws(() => Process.start("true", "asdf"), |
| 14 (e) => e is ArgumentError); | 14 (e) => e is ArgumentError); |
| 15 Expect.throws(() => Process.start("true", ["asdf", 1]), | 15 Expect.throws(() => Process.start("true", ["asdf", 1]), |
| 16 (e) => e is ArgumentError); | 16 (e) => e is ArgumentError); |
| 17 Expect.throws(() => Process.run(["true"], [], null), | 17 ; |
| 18 Expect.throws(() => Process.start("true", [], workingDirectory: 23), |
| 18 (e) => e is ArgumentError); | 19 (e) => e is ArgumentError); |
| 19 Expect.throws(() => Process.run("true", "asdf", null), | 20 Expect.throws(() => Process.run("true", [], workingDirectory: 23), |
| 20 (e) => e is ArgumentError); | 21 (e) => e is ArgumentError); |
| 21 Expect.throws(() => Process.run("true", ["asdf", 1], null), | 22 |
| 22 (e) => e is ArgumentError); | 23 Process.run("true", [], stdoutEncoding: 23) |
| 23 var options = new ProcessOptions(); | 24 .then((_) => Expect.fail("expected error"), onError: (_) {}); |
| 24 options.workingDirectory = 23; | 25 |
| 25 Expect.throws(() => Process.start("true", [], options), | 26 Process.run("true", [], stderrEncoding: 23) |
| 26 (e) => e is ArgumentError); | 27 .then((_) => Expect.fail("expected error"), onError: (_) {}); |
| 27 Expect.throws(() => Process.run("true", [], options), | |
| 28 (e) => e is ArgumentError); | |
| 29 options = new ProcessOptions(); | |
| 30 options.stdoutEncoding = 23; | |
| 31 Expect.throws(() => Process.run("true", [], options), | |
| 32 (e) => e is ArgumentError); | |
| 33 options = new ProcessOptions(); | |
| 34 options.stderrEncoding = 23; | |
| 35 Expect.throws(() => Process.run("true", [], options), | |
| 36 (e) => e is ArgumentError); | |
| 37 } | 28 } |
| OLD | NEW |