summaryrefslogtreecommitdiff
path: root/test/disabled/script/fact.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-05-09 03:53:41 +0000
committerPaul Phillips <paulp@improving.org>2009-05-09 03:53:41 +0000
commit2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2 (patch)
tree9bb2044c595fe260c352a00cf98bb2ecece50437 /test/disabled/script/fact.scala
parentf7ab13b08e085c3bf94d857fc9648ee724e4cb08 (diff)
downloadscala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.tar.gz
scala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.tar.bz2
scala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.zip
Organized disabled directory so it works with p...
Organized disabled directory so it works with partest. You can run ./partest --srcpath disabled to run the tests in that location. Fixed a few tests in disabled and pending and moved to files.
Diffstat (limited to 'test/disabled/script/fact.scala')
-rw-r--r--test/disabled/script/fact.scala30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/disabled/script/fact.scala b/test/disabled/script/fact.scala
new file mode 100644
index 0000000000..d48dac6f0f
--- /dev/null
+++ b/test/disabled/script/fact.scala
@@ -0,0 +1,30 @@
+#!/bin/sh
+# fact - A simple Scala script that prints out the factorial of
+# the argument specified on the command line.
+
+cygwin=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+esac
+
+SOURCE="$0";
+if $cygwin; then
+ if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
+ format=mixed
+ else
+ format=windows
+ fi
+ SOURCE=`cygpath --$format "$SOURCE"`;
+fi
+
+exec scala -nocompdaemon "$SOURCE" "$@"
+!#
+
+
+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))