diff options
author | michelou <michelou@epfl.ch> | 2008-11-01 20:01:29 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-11-01 20:01:29 +0000 |
commit | c50dd4e212fff79020f0100d1a81ab64b599251f (patch) | |
tree | 70a9254b69b4f1175b378b7e969d0188fd701759 | |
parent | 6599832787acde26f4b621c6e19ffe2bbbd180a1 (diff) | |
download | scala-c50dd4e212fff79020f0100d1a81ab64b599251f.tar.gz scala-c50dd4e212fff79020f0100d1a81ab64b599251f.tar.bz2 scala-c50dd4e212fff79020f0100d1a81ab64b599251f.zip |
fixed "script" tests on Windows (Cygwin+DOS)
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 10 | ||||
-rwxr-xr-x | test/files/jvm/mkLibNatives.bat | 2 | ||||
-rwxr-xr-x | test/files/script/fact.bat | 17 | ||||
-rwxr-xr-x | test/files/script/second.bat | 3 | ||||
-rwxr-xr-x | test/files/script/t1015.bat | 12 | ||||
-rwxr-xr-x | test/files/script/t1017.bat | 15 | ||||
-rwxr-xr-x | test/files/script/utf8.bat | 11 |
7 files changed, 68 insertions, 2 deletions
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index d73a11dff7..57065df99e 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -774,6 +774,7 @@ class Worker(val fileManager: FileManager) extends Actor { } } case "script" => { + val osName = System.getProperty("os.name", "") for (file <- files) { // when option "--failed" is provided // execute test only if log file is present @@ -800,7 +801,14 @@ class Worker(val fileManager: FileManager) extends Actor { } else "" try { - val proc = Runtime.getRuntime.exec(file.getAbsolutePath+argString) + val cmdString = + if (osName startsWith "Windows") { + val batchFile = new File(file.getParentFile, fileBase+".bat") + NestUI.verbose("batchFile: "+batchFile) + batchFile.getAbsolutePath + } + else file.getAbsolutePath + val proc = Runtime.getRuntime.exec(cmdString+argString) val in = proc.getInputStream val err = proc.getErrorStream val writer = new PrintWriter(new FileWriter(logFile), true) diff --git a/test/files/jvm/mkLibNatives.bat b/test/files/jvm/mkLibNatives.bat index 7fc88f91c3..045afe0ca2 100755 --- a/test/files/jvm/mkLibNatives.bat +++ b/test/files/jvm/mkLibNatives.bat @@ -16,7 +16,7 @@ set STDOUT=NUL if %DEBUG%==1 set STDOUT=CON
set CLASS_NAME=Test$
-set CLASS_DIR=natives-jvm
+set CLASS_DIR=.
set OBJ_NAME=natives
set LIB_NAME=natives-32
diff --git a/test/files/script/fact.bat b/test/files/script/fact.bat new file mode 100755 index 0000000000..bee0ba25c6 --- /dev/null +++ b/test/files/script/fact.bat @@ -0,0 +1,17 @@ +::#!
+:: fact - A simple Scala batch file that prints out the factorial
+:: of the argument specified on the command line.
+
+@echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+
+val x = argv(0).toInt
+
+def fact(x: Int):Int =
+ if(x==0) 1
+ else x*fact(x-1)
+
+Console.println("fact(" + x + ") = " + fact(x))
diff --git a/test/files/script/second.bat b/test/files/script/second.bat new file mode 100755 index 0000000000..222372d543 --- /dev/null +++ b/test/files/script/second.bat @@ -0,0 +1,3 @@ +@echo off + +scala -nocompdaemon -e "println(\"My second argument is \" + args(1))" arg1 arg2 diff --git a/test/files/script/t1015.bat b/test/files/script/t1015.bat new file mode 100755 index 0000000000..7475313d7e --- /dev/null +++ b/test/files/script/t1015.bat @@ -0,0 +1,12 @@ +::#!
+:: t1015 - <description>.
+
+@echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+case class Test(one : Int, two : Int)
+object Test{
+ def apply(one : Int): Test = Test(one, 2);
+}
diff --git a/test/files/script/t1017.bat b/test/files/script/t1017.bat new file mode 100755 index 0000000000..369dbd2aca --- /dev/null +++ b/test/files/script/t1017.bat @@ -0,0 +1,15 @@ +::#!
+::# t1017 - <description>.
+
+@echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+def foo = {
+ bar
+}
+
+var x = 1
+
+def bar = 1
diff --git a/test/files/script/utf8.bat b/test/files/script/utf8.bat new file mode 100755 index 0000000000..8bc5c886f7 --- /dev/null +++ b/test/files/script/utf8.bat @@ -0,0 +1,11 @@ +::#!
+:: utf8 - <description>.
+
+@echo off
+call scala -nocompdaemon %0 %*
+goto :eof
+::!#
+
+/*Comment Комментарий*/
+Console.println("QWERTY");
+Console.println("ЙЦУКЕН");
|