summaryrefslogtreecommitdiff
path: root/test/files/script
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2006-05-26 12:23:50 +0000
committerLex Spoon <lex@lexspoon.org>2006-05-26 12:23:50 +0000
commitfa80c56a42832ed9b3b778266fb0da5cd0a4a18a (patch)
tree26395564ab58ed96d91702651123cc818144b47b /test/files/script
parente3b1cc9130d7046905cc86f0f25e25c1010c5900 (diff)
downloadscala-fa80c56a42832ed9b3b778266fb0da5cd0a4a18a.tar.gz
scala-fa80c56a42832ed9b3b778266fb0da5cd0a4a18a.tar.bz2
scala-fa80c56a42832ed9b3b778266fb0da5cd0a4a18a.zip
added a test case for scalascript
Diffstat (limited to 'test/files/script')
-rw-r--r--test/files/script/fact.args1
-rw-r--r--test/files/script/fact.check1
-rwxr-xr-xtest/files/script/fact.scala15
3 files changed, 17 insertions, 0 deletions
diff --git a/test/files/script/fact.args b/test/files/script/fact.args
new file mode 100644
index 0000000000..7813681f5b
--- /dev/null
+++ b/test/files/script/fact.args
@@ -0,0 +1 @@
+5 \ No newline at end of file
diff --git a/test/files/script/fact.check b/test/files/script/fact.check
new file mode 100644
index 0000000000..22aa60821e
--- /dev/null
+++ b/test/files/script/fact.check
@@ -0,0 +1 @@
+fact(5) = 120
diff --git a/test/files/script/fact.scala b/test/files/script/fact.scala
new file mode 100755
index 0000000000..a15c93452c
--- /dev/null
+++ b/test/files/script/fact.scala
@@ -0,0 +1,15 @@
+#!/bin/sh
+# fact - A simple Scala script that prints out the factorial of
+# the argument specified on the command line.
+
+exec scalascript "$0" "$@"
+!#
+
+
+val x = Integer.parseInt(argv(0))
+
+def fact(x: Int):Int =
+ if(x==0) 1
+ else x*fact(x-1)
+
+Console.println("fact(" + x + ") = " + fact(x))