| Index: tests/standalone/src/ProcessInvalidArgumentsTest.dart
|
| diff --git a/tests/standalone/src/ProcessInvalidArgumentsTest.dart b/tests/standalone/src/ProcessInvalidArgumentsTest.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..aeaf479846e3adc048db46bfea8255df95aca68f
|
| --- /dev/null
|
| +++ b/tests/standalone/src/ProcessInvalidArgumentsTest.dart
|
| @@ -0,0 +1,64 @@
|
| +// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +//
|
| +// Process test program to test that invalid arguments throw exceptions.
|
| +
|
| +void testNonStringPath() {
|
| + try {
|
| + Process p = new Process(["true"], []);
|
| + Expect.fail("Did not throw exception");
|
| + } catch(var e) {
|
| + Expect.isTrue(e is ProcessException, "Wrong exception type: $e");
|
| + }
|
| +}
|
| +
|
| +void testNonListArguments() {
|
| + try {
|
| + Process p = new Process("true", "asdf");
|
| + Expect.fail("Did not throw exception");
|
| + } catch(var e) {
|
| + Expect.isTrue(e is ProcessException, "Wrong exception type: $e");
|
| + }
|
| +}
|
| +
|
| +void testNonStringArgument() {
|
| + try {
|
| + Process p = new Process("true", ["asdf", 1]);
|
| + Expect.fail("Did not throw exception");
|
| + } catch(var e) {
|
| + Expect.isTrue(e is ProcessException, "Wrong exception type: $e");
|
| + }
|
| +}
|
| +
|
| +class MyString implements String {
|
| + MyString();
|
| +}
|
| +
|
| +void testMyStringArgument() {
|
| + Process p = new Process("true", [new MyString()]);
|
| + try {
|
| + p.start();
|
| + Expect.fail("Did not throw exception");
|
| + } catch(var e) {
|
| + Expect.isTrue(e is ProcessException, "Wrong exception type: $e");
|
| + }
|
| +}
|
| +
|
| +void testMyStringPath() {
|
| + Process p = new Process(new MyString(), ['asdf']);
|
| + try {
|
| + p.start();
|
| + Expect.fail("Did not throw exception");
|
| + } catch(var e) {
|
| + Expect.isTrue(e is ProcessException, "Wrong exception type: $e");
|
| + }
|
| +}
|
| +
|
| +void main() {
|
| + testNonStringPath();
|
| + testNonListArguments();
|
| + testNonStringArgument();
|
| + testMyStringArgument();
|
| + testMyStringPath();
|
| +}
|
|
|