Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: tests/standalone/src/ProcessInvalidArgumentsTest.dart

Issue 8383037: Improve error handling in the process library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698