|
@@ -3,7 +3,7 @@ package io;
|
|
import sys.io.Process;
|
|
import sys.io.Process;
|
|
|
|
|
|
class TestProcess extends haxe.unit.TestCase {
|
|
class TestProcess extends haxe.unit.TestCase {
|
|
- #if !php //should be fixed
|
|
|
|
|
|
+ #if !php //FIXME
|
|
function testArguments() {
|
|
function testArguments() {
|
|
var bin = sys.FileSystem.absolutePath(TestArguments.bin);
|
|
var bin = sys.FileSystem.absolutePath(TestArguments.bin);
|
|
var args = TestArguments.expectedArgs;
|
|
var args = TestArguments.expectedArgs;
|
|
@@ -43,6 +43,7 @@ class TestProcess extends haxe.unit.TestCase {
|
|
assertEquals(0, exitCode);
|
|
assertEquals(0, exitCode);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #if !(neko || cpp || cs) //FIXME
|
|
function testCommandName() {
|
|
function testCommandName() {
|
|
// This is just a script that behaves like ExitCode.hx,
|
|
// This is just a script that behaves like ExitCode.hx,
|
|
// which exits with the code same as the first given argument.
|
|
// which exits with the code same as the first given argument.
|
|
@@ -53,14 +54,14 @@ class TestProcess extends haxe.unit.TestCase {
|
|
'#!/bin/sh\nexit $1';
|
|
'#!/bin/sh\nexit $1';
|
|
}
|
|
}
|
|
for (name in FileNames.names) {
|
|
for (name in FileNames.names) {
|
|
- //call without ext
|
|
|
|
|
|
+ //call with ext
|
|
var scriptExt = switch (Sys.systemName()) {
|
|
var scriptExt = switch (Sys.systemName()) {
|
|
case "Windows":
|
|
case "Windows":
|
|
".bat";
|
|
".bat";
|
|
case "Mac", "Linux", _:
|
|
case "Mac", "Linux", _:
|
|
- "";
|
|
|
|
|
|
+ ".sh";
|
|
}
|
|
}
|
|
- var path = "temp/" + name + scriptExt;
|
|
|
|
|
|
+ var path = sys.FileSystem.absolutePath("temp/" + name + scriptExt);
|
|
sys.io.File.saveContent(path, scriptContent);
|
|
sys.io.File.saveContent(path, scriptContent);
|
|
|
|
|
|
switch (Sys.systemName()) {
|
|
switch (Sys.systemName()) {
|
|
@@ -73,18 +74,21 @@ class TestProcess extends haxe.unit.TestCase {
|
|
|
|
|
|
var random = Std.random(256);
|
|
var random = Std.random(256);
|
|
var exitCode = new Process(path, [Std.string(random)]).exitCode();
|
|
var exitCode = new Process(path, [Std.string(random)]).exitCode();
|
|
|
|
+ if (exitCode != random)
|
|
|
|
+ trace(name);
|
|
assertEquals(random, exitCode);
|
|
assertEquals(random, exitCode);
|
|
sys.FileSystem.deleteFile(path);
|
|
sys.FileSystem.deleteFile(path);
|
|
|
|
|
|
|
|
|
|
- //call with ext
|
|
|
|
|
|
+
|
|
|
|
+ //call without ext
|
|
var scriptExt = switch (Sys.systemName()) {
|
|
var scriptExt = switch (Sys.systemName()) {
|
|
case "Windows":
|
|
case "Windows":
|
|
".bat";
|
|
".bat";
|
|
case "Mac", "Linux", _:
|
|
case "Mac", "Linux", _:
|
|
- ".sh";
|
|
|
|
|
|
+ "";
|
|
}
|
|
}
|
|
- var path = "temp/" + name + scriptExt;
|
|
|
|
|
|
+ var path = sys.FileSystem.absolutePath("temp/" + name + scriptExt);
|
|
sys.io.File.saveContent(path, scriptContent);
|
|
sys.io.File.saveContent(path, scriptContent);
|
|
|
|
|
|
switch (Sys.systemName()) {
|
|
switch (Sys.systemName()) {
|
|
@@ -97,11 +101,15 @@ class TestProcess extends haxe.unit.TestCase {
|
|
|
|
|
|
var random = Std.random(256);
|
|
var random = Std.random(256);
|
|
var exitCode = new Process(path, [Std.string(random)]).exitCode();
|
|
var exitCode = new Process(path, [Std.string(random)]).exitCode();
|
|
|
|
+ if (exitCode != random)
|
|
|
|
+ trace(name);
|
|
assertEquals(random, exitCode);
|
|
assertEquals(random, exitCode);
|
|
sys.FileSystem.deleteFile(path);
|
|
sys.FileSystem.deleteFile(path);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- #end
|
|
|
|
|
|
+ #end //!neko
|
|
|
|
+
|
|
|
|
+ #end //!php
|
|
|
|
|
|
function testExitCode() {
|
|
function testExitCode() {
|
|
var bin = sys.FileSystem.absolutePath(ExitCode.bin);
|
|
var bin = sys.FileSystem.absolutePath(ExitCode.bin);
|