| 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 // Test script for testing that output is handled correctly for | 5 // Test script for testing that output is handled correctly for |
| 6 // non-interactive processes started with Process.run. | 6 // non-interactive processes started with Process.run. |
| 7 | 7 |
| 8 #import("dart:io"); | 8 #import("dart:io"); |
| 9 #source("ProcessTestUtil.dart"); | 9 #source("process_test_util.dart"); |
| 10 | 10 |
| 11 checkOutput(encoding, output) { | 11 checkOutput(encoding, output) { |
| 12 if (encoding == 'ascii') { | 12 if (encoding == 'ascii') { |
| 13 Expect.equals(output, 'abc'); | 13 Expect.equals(output, 'abc'); |
| 14 } else if (encoding == 'latin1') { | 14 } else if (encoding == 'latin1') { |
| 15 Expect.equals(output, 'æøå'); | 15 Expect.equals(output, 'æøå'); |
| 16 } else if (encoding == 'utf8') { | 16 } else if (encoding == 'utf8') { |
| 17 Expect.listEquals(output.charCodes(), [955]); | 17 Expect.listEquals(output.charCodes(), [955]); |
| 18 } | 18 } |
| 19 } | 19 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 new Process.run(getDartFileName(), [scriptFile, encoding, stream], | 42 new Process.run(getDartFileName(), [scriptFile, encoding, stream], |
| 43 options, (exit, out, err) { | 43 options, (exit, out, err) { |
| 44 Expect.equals(exit, 0); | 44 Expect.equals(exit, 0); |
| 45 Expect.equals(out, ''); | 45 Expect.equals(out, ''); |
| 46 checkOutput(encoding, err); | 46 checkOutput(encoding, err); |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 main() { | 51 main() { |
| 52 var scriptFile = new File("tests/standalone/src/io/ProcessStdIOScript2.dart"); | 52 var scriptFile = new File("tests/standalone/io/process_std_io_script2.dart"); |
| 53 if (!scriptFile.existsSync()) { | 53 if (!scriptFile.existsSync()) { |
| 54 scriptFile = | 54 scriptFile = |
| 55 new File("../tests/standalone/src/io/ProcessStdIOScript2.dart"); | 55 new File("../tests/standalone/io/process_std_io_script2.dart"); |
| 56 } | 56 } |
| 57 Expect.isTrue(scriptFile.existsSync()); | 57 Expect.isTrue(scriptFile.existsSync()); |
| 58 test(scriptFile.name, 'ascii', 'stdout'); | 58 test(scriptFile.name, 'ascii', 'stdout'); |
| 59 test(scriptFile.name, 'ascii', 'stderr'); | 59 test(scriptFile.name, 'ascii', 'stderr'); |
| 60 test(scriptFile.name, 'latin1', 'stdout'); | 60 test(scriptFile.name, 'latin1', 'stdout'); |
| 61 test(scriptFile.name, 'latin1', 'stderr'); | 61 test(scriptFile.name, 'latin1', 'stderr'); |
| 62 test(scriptFile.name, 'utf8', 'stdout'); | 62 test(scriptFile.name, 'utf8', 'stdout'); |
| 63 test(scriptFile.name, 'utf8', 'stderr'); | 63 test(scriptFile.name, 'utf8', 'stderr'); |
| 64 | 64 |
| 65 } | 65 } |
| OLD | NEW |