Fixes #379. Numerous fixes for io/Process tests
diff --git a/LibTest/io/Process/run_A01_t02.dart b/LibTest/io/Process/run_A01_t02.dart
index c534a96..ab985e4 100644
--- a/LibTest/io/Process/run_A01_t02.dart
+++ b/LibTest/io/Process/run_A01_t02.dart
@@ -34,8 +34,7 @@
main() {
String executable = Platform.resolvedExecutable;
- String fileName = "start_A01_t01_lib.dart";
- File file = new File(fileName);
+ File file = new File.fromUri(Platform.script.resolve("start_A01_t01_lib.dart"));
asyncStart();
Process.run(executable, [file.absolute.path]).then((ProcessResult results) {
Expect.equals(0, results.exitCode);
diff --git a/LibTest/io/Process/run_A01_t03.dart b/LibTest/io/Process/run_A01_t03.dart
index 392c9eb..0a0c28b 100644
--- a/LibTest/io/Process/run_A01_t03.dart
+++ b/LibTest/io/Process/run_A01_t03.dart
@@ -25,7 +25,7 @@
* @description Checks that static method [run] starts a process and runs it
* non-interactively to completion. Returns a Future<ProcessResult> that
* completes with the result of running the process, i.e., exit code, standard
- * out and standard in. Test that there should be an error code 255 if invalid
+ * out and standard in. Test that there should be an error code 254 if invalid
* file path is used on Windows
* (see https://github.com/dart-lang/sdk/issues/31611)
* @author sgrekhov@unipro.ru
@@ -37,12 +37,10 @@
main() {
if (Platform.isWindows) {
String executable = Platform.resolvedExecutable;
- String fileName = "start_A01_t01_lib.dart";
- File file = new File(fileName);
- String invalidFilePath = "/" + file.absolute.path;
+ File file = new File.fromUri(Platform.script.resolve("not_existing.dart"));
asyncStart();
- Process.run(executable, [invalidFilePath]).then((ProcessResult results) {
- Expect.equals(255, results.exitCode);
+ Process.run(executable, [file.path]).then((ProcessResult results) {
+ Expect.equals(254, results.exitCode);
Expect.notEquals("", results.stderr);
asyncEnd();
});
diff --git a/LibTest/io/Process/start_A01_t01.dart b/LibTest/io/Process/start_A01_t01.dart
index 9758075..bdb8d39 100644
--- a/LibTest/io/Process/start_A01_t01.dart
+++ b/LibTest/io/Process/start_A01_t01.dart
@@ -33,13 +33,9 @@
main() {
String executable = Platform.resolvedExecutable;
- String file = Platform.script.toFilePath(windows: Platform.isWindows);
- int index = file.indexOf("start_A01_t01.dart");
- String ePath = file.substring(0, index);
- String eFile = ePath + "start_A01_t01_lib.dart";
-
+ File file = new File.fromUri(Platform.script.resolve("start_A01_t01_lib.dart"));
asyncStart();
- Process.start(executable, [eFile]).then((Process process) {
+ Process.start(executable, [file.path]).then((Process process) {
process.stdout.toList().then((List outList) {
Utf8Decoder decoder = new Utf8Decoder();
String decoded = decoder.convert(outList[0]);
diff --git a/LibTest/io/Process/start_A01_t02.dart b/LibTest/io/Process/start_A01_t02.dart
index 94634f4..69eb442 100644
--- a/LibTest/io/Process/start_A01_t02.dart
+++ b/LibTest/io/Process/start_A01_t02.dart
@@ -33,20 +33,17 @@
main() {
String executable = Platform.resolvedExecutable;
- String file = Platform.script.toFilePath(windows: Platform.isWindows);
- int index = file.indexOf("start_A01_t02.dart");
- String ePath = file.substring(0, index);
- String eFile = ePath + "start_A01_t02_lib.dart";
+ File file = new File.fromUri(Platform.script.resolve("start_A01_t02_lib.dart"));
asyncStart();
- Process.start(executable, [eFile]).then((process) {
+ Process.start(executable, [file.path]).then((process) {
process.stdout.toList().then((List outList) {
Expect.equals(0, outList.length);
}).then((_) {
process.stderr.toList().then((List errList) {
Utf8Decoder decoder = new Utf8Decoder();
String decoded = decoder.convert(errList[0]);
- Expect.isTrue(decoded.contains("Unable to find 'main'"));
+ Expect.isTrue(decoded.contains("'main'")); // Unable to find 'main' or The binary program does not contain 'main'
asyncEnd();
});
});
diff --git a/LibTest/io/Process/start_A02_t01.dart b/LibTest/io/Process/start_A02_t01.dart
index af1730d..0c91056 100644
--- a/LibTest/io/Process/start_A02_t01.dart
+++ b/LibTest/io/Process/start_A02_t01.dart
@@ -34,13 +34,10 @@
m["a"] = "aa";
String executable = Platform.resolvedExecutable;
- String file = Platform.script.toFilePath(windows: Platform.isWindows);
- int index = file.indexOf("start_A02_t01.dart");
- String ePath = file.substring(0, index);
- String eFile = ePath + "checkEnvironment_lib.dart";
+ File file = new File.fromUri(Platform.script.resolve("checkEnvironment_lib.dart"));
asyncStart();
- Process.start(executable, [eFile], environment: m).then((Process process) {
+ Process.start(executable, [file.path], environment: m).then((Process process) {
process.stdout.toList().then((List outList) {
Utf8Decoder decode = new Utf8Decoder();
String decoded = decode.convert(outList[0]);
diff --git a/LibTest/io/Process/start_A02_t02.dart b/LibTest/io/Process/start_A02_t02.dart
index 95503e0..bbd998b 100644
--- a/LibTest/io/Process/start_A02_t02.dart
+++ b/LibTest/io/Process/start_A02_t02.dart
@@ -32,13 +32,10 @@
main() {
String envString = Platform.environment.toString();
String executable = Platform.resolvedExecutable;
- String file = Platform.script.toFilePath(windows: Platform.isWindows);
- int index = file.indexOf("start_A02_t02.dart");
- String ePath = file.substring(0, index);
- String eFile = ePath + "checkEnvironment_lib.dart";
+ File file = new File.fromUri(Platform.script.resolve("checkEnvironment_lib.dart"));
asyncStart();
- Process.start(executable, [eFile]).then((Process process) {
+ Process.start(executable, [file.path]).then((Process process) {
process.stdout.toList().then((List outList) {
Utf8Decoder decoder = new Utf8Decoder();
String decoded = decoder.convert(outList[0]);
diff --git a/LibTest/io/Process/start_A03_t01.dart b/LibTest/io/Process/start_A03_t01.dart
index 3177b1d..3adef85 100644
--- a/LibTest/io/Process/start_A03_t01.dart
+++ b/LibTest/io/Process/start_A03_t01.dart
@@ -34,13 +34,10 @@
String envString = Platform.environment.toString();
String executable = Platform.resolvedExecutable;
- String file = Platform.script.toFilePath(windows: Platform.isWindows);
- int index = file.indexOf("start_A03_t01.dart");
- String ePath = file.substring(0, index);
- String eFile = ePath + "checkEnvironment_lib.dart";
+ File file = new File.fromUri(Platform.script.resolve("checkEnvironment_lib.dart"));
asyncStart();
- Process.start(executable, [eFile], environment: m,
+ Process.start(executable, [file.path], environment: m,
includeParentEnvironment: true).then((Process process) {
process.stdout.toList().then((List outList) {
Utf8Decoder decoder = new Utf8Decoder();
diff --git a/LibTest/io/Process/start_A03_t02.dart b/LibTest/io/Process/start_A03_t02.dart
index 9a7ff9c..d924abd 100644
--- a/LibTest/io/Process/start_A03_t02.dart
+++ b/LibTest/io/Process/start_A03_t02.dart
@@ -33,13 +33,10 @@
String envString = Platform.environment.toString();
String executable = Platform.resolvedExecutable;
- String file = Platform.script.toFilePath(windows: Platform.isWindows);
- int index = file.indexOf("start_A03_t02.dart");
- String ePath = file.substring(0, index);
- String eFile = ePath + "checkEnvironment_lib.dart";
+ File file = new File.fromUri(Platform.script.resolve("checkEnvironment_lib.dart"));
asyncStart();
- Process.start(executable, [eFile],
+ Process.start(executable, [file.path],
environment: m, includeParentEnvironment: false).then((Process process) {
process.stdout.toList().then((List outList) {
Utf8Decoder decode = new Utf8Decoder();
diff --git a/LibTest/io/Process/stream_lib.dart b/LibTest/io/Process/stream_lib.dart
index 478cd5f..6bf6473 100644
--- a/LibTest/io/Process/stream_lib.dart
+++ b/LibTest/io/Process/stream_lib.dart
@@ -19,8 +19,6 @@
}
if (arguments.length > 2) {
stdin.listen((List<int> event){
- //print("in");
- //print(event);
Utf8Decoder decoder = new Utf8Decoder();
String decoded = decoder.convert(event);
stdout.write(decoded);