| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 // |
| 5 // Process test program to test that invalid arguments throw exceptions. |
| 6 |
| 7 void testNonStringPath() { |
| 8 try { |
| 9 Process p = new Process(["true"], []); |
| 10 Expect.fail("Did not throw exception"); |
| 11 } catch(var e) { |
| 12 Expect.isTrue(e is ProcessException, "Wrong exception type: $e"); |
| 13 } |
| 14 } |
| 15 |
| 16 void testNonListArguments() { |
| 17 try { |
| 18 Process p = new Process("true", "asdf"); |
| 19 Expect.fail("Did not throw exception"); |
| 20 } catch(var e) { |
| 21 Expect.isTrue(e is ProcessException, "Wrong exception type: $e"); |
| 22 } |
| 23 } |
| 24 |
| 25 void testNonStringArgument() { |
| 26 try { |
| 27 Process p = new Process("true", ["asdf", 1]); |
| 28 Expect.fail("Did not throw exception"); |
| 29 } catch(var e) { |
| 30 Expect.isTrue(e is ProcessException, "Wrong exception type: $e"); |
| 31 } |
| 32 } |
| 33 |
| 34 class MyString implements String { |
| 35 MyString(); |
| 36 } |
| 37 |
| 38 void testMyStringArgument() { |
| 39 Process p = new Process("true", [new MyString()]); |
| 40 try { |
| 41 p.start(); |
| 42 Expect.fail("Did not throw exception"); |
| 43 } catch(var e) { |
| 44 Expect.isTrue(e is ProcessException, "Wrong exception type: $e"); |
| 45 } |
| 46 } |
| 47 |
| 48 void testMyStringPath() { |
| 49 Process p = new Process(new MyString(), ['asdf']); |
| 50 try { |
| 51 p.start(); |
| 52 Expect.fail("Did not throw exception"); |
| 53 } catch(var e) { |
| 54 Expect.isTrue(e is ProcessException, "Wrong exception type: $e"); |
| 55 } |
| 56 } |
| 57 |
| 58 void main() { |
| 59 testNonStringPath(); |
| 60 testNonListArguments(); |
| 61 testNonStringArgument(); |
| 62 testMyStringArgument(); |
| 63 testMyStringPath(); |
| 64 } |
| OLD | NEW |