diff options
author | Lex Spoon <lex@lexspoon.org> | 2006-05-26 12:23:50 +0000 |
---|---|---|
committer | Lex Spoon <lex@lexspoon.org> | 2006-05-26 12:23:50 +0000 |
commit | fa80c56a42832ed9b3b778266fb0da5cd0a4a18a (patch) | |
tree | 26395564ab58ed96d91702651123cc818144b47b /test/files | |
parent | e3b1cc9130d7046905cc86f0f25e25c1010c5900 (diff) | |
download | scala-fa80c56a42832ed9b3b778266fb0da5cd0a4a18a.tar.gz scala-fa80c56a42832ed9b3b778266fb0da5cd0a4a18a.tar.bz2 scala-fa80c56a42832ed9b3b778266fb0da5cd0a4a18a.zip |
added a test case for scalascript
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/script/fact.args | 1 | ||||
-rw-r--r-- | test/files/script/fact.check | 1 | ||||
-rwxr-xr-x | test/files/script/fact.scala | 15 |
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)) |