Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test PHP * Decoupled sys test from RunCi, particularly RunCi doesn't have to pass the test arguments. * Added test cases for Sys.command, sys.io.Process, and Sys.exitCode
- Loading branch information
Showing
22 changed files
with
395 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-neko RunCi.n | ||
-main RunCi | ||
-lib hx-yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TestArguments.txt | ||
testcase-test-file.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
compile-each.hxml | ||
-main Main | ||
-cpp bin/cpp | ||
|
||
--next | ||
compile-each.hxml | ||
-main TestArguments | ||
-cpp bin/cpp | ||
|
||
--next | ||
compile-each.hxml | ||
-main ExitCode | ||
-cpp bin/cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
compile-each.hxml | ||
-main Main | ||
-cs bin/cs | ||
|
||
--next | ||
compile-each.hxml | ||
-main TestArguments | ||
-cs bin/cs | ||
|
||
--next | ||
compile-each.hxml | ||
-main ExitCode | ||
-cs bin/cs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
-debug | ||
-cp src | ||
-resource args.xml | ||
-main Main | ||
-resource args.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
compile-each.hxml | ||
-main Main | ||
-java bin/java | ||
|
||
--next | ||
compile-each.hxml | ||
-main TestArguments | ||
-java bin/java | ||
|
||
--next | ||
compile-each.hxml | ||
-main ExitCode | ||
-java bin/java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
compile-each.hxml | ||
-main Main | ||
--interp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
compile-each.hxml | ||
-neko bin/neko/sys.n | ||
-main Main | ||
-neko bin/neko/sys.n | ||
|
||
--next | ||
compile-each.hxml | ||
-main TestArguments | ||
-neko bin/neko/TestArguments.n | ||
|
||
--next | ||
compile-each.hxml | ||
-main ExitCode | ||
-neko bin/neko/ExitCode.n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
compile-each.hxml | ||
-main Main | ||
-php bin/php/Main | ||
|
||
--next | ||
compile-each.hxml | ||
-main TestArguments | ||
-php bin/php/TestArguments | ||
|
||
--next | ||
compile-each.hxml | ||
-main ExitCode | ||
-php bin/php/ExitCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
compile-each.hxml | ||
-python bin/python/sys.py | ||
-main Main | ||
-python bin/python/sys.py | ||
|
||
--next | ||
compile-each.hxml | ||
-main TestArguments | ||
-python bin/python/TestArguments.py | ||
|
||
--next | ||
compile-each.hxml | ||
-main ExitCode | ||
-python bin/python/ExitCode.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This is not run by CIs, just for convenience when testing manually. | ||
|
||
# Compile everything first. | ||
compile.hxml | ||
|
||
# Mac/Linux | ||
--next | ||
-cmd echo Neko && neko bin/neko/sys.n | ||
-cmd echo Python && python3 bin/python/sys.py | ||
-cmd echo Cpp && bin/cpp/Main-Debug | ||
-cmd echo CS && mono bin/cs/bin/Main-Debug.exe | ||
-cmd echo Java && java -jar bin/java/Main-Debug.jar | ||
-cmd echo Php && php bin/php/Main/index.php | ||
|
||
# Windows | ||
# --next | ||
# -cmd echo Neko && neko bin\neko\sys.n | ||
# -cmd echo Python && python3 bin\python\sys.py | ||
# -cmd echo Cpp && bin\cpp\Main-Debug.exe | ||
# -cmd echo CS && bin\cs\bin\Main-Debug.exe | ||
# -cmd echo Java && java -jar bin\java\Main-Debug.jar | ||
# -cmd echo Php && php bin\php\Main\index.php | ||
|
||
# Macro has to be placed at the end since it would exit the compilation process. | ||
--next | ||
-cmd echo Macro | ||
--next | ||
compile-macro.hxml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
This is intented to be used by TestSys and io.TestProcess. | ||
*/ | ||
class ExitCode { | ||
static public var bin:String = | ||
#if neko | ||
"bin/neko/ExitCode.n"; | ||
#elseif cpp | ||
#if debug | ||
"bin/cpp/ExitCode-debug"; | ||
#else | ||
"bin/cpp/ExitCode"; | ||
#end | ||
#elseif cs | ||
#if debug | ||
"bin/cs/bin/ExitCode-Debug.exe"; | ||
#else | ||
"bin/cs/bin/ExitCode.exe"; | ||
#end | ||
#elseif java | ||
#if debug | ||
"bin/java/ExitCode-Debug.jar"; | ||
#else | ||
"bin/java/ExitCode.jar"; | ||
#end | ||
#elseif python | ||
"bin/python/ExitCode.py"; | ||
#elseif php | ||
"bin/php/ExitCode/index.php"; | ||
#else | ||
null; | ||
#end | ||
|
||
static function main():Void { | ||
Sys.exit(Std.parseInt(Sys.args()[0])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
This test is intented to be used by TestSys and io.TestProcess. | ||
*/ | ||
class TestArguments extends haxe.unit.TestCase { | ||
static public var expectedArgs(get, null):Array<String>; | ||
static function get_expectedArgs() { | ||
return expectedArgs != null ? expectedArgs : expectedArgs = [ | ||
for (arg in new haxe.xml.Fast(Xml.parse(haxe.Resource.getString("args.xml"))).node.args.nodes.arg) | ||
arg.innerData | ||
]; | ||
} | ||
|
||
static public var bin:String = | ||
#if neko | ||
"bin/neko/TestArguments.n"; | ||
#elseif cpp | ||
#if debug | ||
"bin/cpp/TestArguments-debug"; | ||
#else | ||
"bin/cpp/TestArguments"; | ||
#end | ||
#elseif cs | ||
#if debug | ||
"bin/cs/bin/TestArguments-Debug.exe"; | ||
#else | ||
"bin/cs/bin/TestArguments.exe"; | ||
#end | ||
#elseif java | ||
#if debug | ||
"bin/java/TestArguments-Debug.jar"; | ||
#else | ||
"bin/java/TestArguments.jar"; | ||
#end | ||
#elseif python | ||
"bin/python/TestArguments.py"; | ||
#elseif php | ||
"bin/php/TestArguments/index.php"; | ||
#else | ||
null; | ||
#end | ||
|
||
function testArgs() { | ||
var args = Sys.args(); | ||
// trace(args); | ||
for (i in 0...expectedArgs.length) { | ||
assertEquals(expectedArgs[i], args[i]); | ||
} | ||
assertEquals(expectedArgs.length, args.length); | ||
} | ||
|
||
static function main():Void { | ||
var log = sys.io.File.write("TestArguments.txt"); | ||
haxe.unit.TestRunner.print = function(v){ | ||
log.writeString(v); | ||
}; | ||
var runner = new haxe.unit.TestRunner(); | ||
runner.add(new TestArguments()); | ||
var code = runner.run() ? 0 : 1; | ||
log.flush(); | ||
log.close(); | ||
Sys.exit(code); | ||
} | ||
} |
Oops, something went wrong.
5e4b7f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andyli can we close #3411 and #3402 issues now that we have tests for Sys.command and argument escaping? I'm sure there are some issues with specific targets, but it's better to report and fix them separately as I don't really understand what should I do for #3411 and #3402