diff options
author | paltherr <paltherr@epfl.ch> | 2004-01-22 09:21:25 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-01-22 09:21:25 +0000 |
commit | e6bcb618fa7b897d1340c03820547f9efb119fa7 (patch) | |
tree | f857419d5e0eba7e9738180a5ffc703fcbea82df | |
parent | d9059f96dcd6c77aa9721028267d92bb77300949 (diff) | |
download | scala-e6bcb618fa7b897d1340c03820547f9efb119fa7.tar.gz scala-e6bcb618fa7b897d1340c03820547f9efb119fa7.tar.bz2 scala-e6bcb618fa7b897d1340c03820547f9efb119fa7.zip |
- Added files test/files/shl/basic.*
-rw-r--r-- | config/list/test-run.lst | 2 | ||||
-rw-r--r-- | test/files/shl/basic.check | 38 | ||||
-rw-r--r-- | test/files/shl/basic.scala | 41 |
3 files changed, 81 insertions, 0 deletions
diff --git a/config/list/test-run.lst b/config/list/test-run.lst index f62bc55639..6867cf71dc 100644 --- a/config/list/test-run.lst +++ b/config/list/test-run.lst @@ -30,6 +30,8 @@ run/overloads.scala run/regularpatmat.scala run/runtime.scala +shl/basic.scala + xml/lnk.scala xml/xhtml.scala diff --git a/test/files/shl/basic.check b/test/files/shl/basic.check new file mode 100644 index 0000000000..bee7e5192d --- /dev/null +++ b/test/files/shl/basic.check @@ -0,0 +1,38 @@ +> > > > > > (): scala.Unit +> false: scala.Boolean(false) +> 1: scala.Char(1) +> 2: scala.Int(2) +> 3: scala.Long(3) +> 4.0: scala.Float(4.0) +> 5.0: scala.Double(5.0) +> null: scala.AllRef +> hello: java.lang.String(hello) +> List(): scala.Nil +> List(1,2,3): scala.List[scala.Int] +> > Exception in thread "main" java.lang.Error: error + at $console$15.$console$15(<console>:1) + at <root>.$console$15(<console>:1) +> > | val x: scala.Int(5) = 5 +5: scala.Int(5) +> <console>:1: not found: value y +y +^ +> > def fact(scala.Int): scala.Int +> <console>:1: not found: value fac +fac(5) +^ +> 120: scala.Int +> > | def length[X](scala.Int,scala.List[X]): scala.Int +> <console>:1: wrong number of arguments for method length(scala.Int,scala.List[X]) +length(Nil) + ^ +> 0: scala.Int +> 5: scala.Int +> > | | | class Point extends java.lang.Object with scala.ScalaObject { + def move(scala.Int,scala.Int): $console$25.Point, + def toString(): java.lang.String +} +> val p1: $console$25.Point = Point(3,7) +> Point(10,10): $console$25.Point +> > > +[Leaving scalarun] diff --git a/test/files/shl/basic.scala b/test/files/shl/basic.scala new file mode 100644 index 0000000000..4b0841f5e6 --- /dev/null +++ b/test/files/shl/basic.scala @@ -0,0 +1,41 @@ +//############################################################################ +// Basic Operations +//############################################################################ +// $Id$ + +() +false +'1' +2 +3l +4.0f +5.0d +null +"hello" +Nil +List(1,2,3) + +throw new Error("error") + +val x = 5; +x +y + +def fact(n: Int): Int = if (n == 1) 1 else n*fact(n - 1) +fac(5) +fact(5) + +def length[X](a: Int, ls: List[X]): Int = + if (ls.isEmpty) a else length(a + 1, ls.tail) +length(Nil) +length(0, Nil) +length(0, List(1,2,3,4,5)) + +class Point(x: Int, y: Int) { + def move(dx: Int, dy: Int): Point = new Point(x + dx, y + dy); + override def toString(): String = "Point(" + x + "," + y + ")"; +} +val p1 = new Point(3,7) +p1.move(7,3) + +//############################################################################ |