From 01a338c1ac4a3ef51db721b6159d9add514543ef Mon Sep 17 00:00:00 2001 From: Geoffrey Washburn Date: Wed, 19 Nov 2008 09:09:43 +0000 Subject: Interpreter test now only works on 1.5 or above... Interpreter test now only works on 1.5 or above JVMs. --- test/files/run/interpreter.check | 212 --------------------------------------- test/files/run/interpreter.scala | 172 ------------------------------- 2 files changed, 384 deletions(-) delete mode 100644 test/files/run/interpreter.check delete mode 100644 test/files/run/interpreter.scala (limited to 'test/files/run') diff --git a/test/files/run/interpreter.check b/test/files/run/interpreter.check deleted file mode 100644 index aa2776f34b..0000000000 --- a/test/files/run/interpreter.check +++ /dev/null @@ -1,212 +0,0 @@ -Type in expressions to have them evaluated. -Type :help for more information. - -scala> -scala> -scala> res0: Int = 7 - -scala> | | | | gcd: (Int,Int)Int - -scala> five: Int = 5 - -scala> x: Int = 1 - -scala> x: Int = 2 - -scala> three: Int = 3 - -scala> defined type alias anotherint - -scala> four: anotherint = 4 - -scala> :5: error: type mismatch; - found : java.lang.String("hello") - required: anotherint - val bogus: anotherint = "hello" - ^ - -scala> defined trait PointlessTrait - -scala> x: Int = 2 -y: Int = 3 - -scala> hello - -scala> -scala> -scala> t1513: Array[Null] = Array(null) - -scala> -scala> atom: scala.xml.Atom[Unit] = () - -scala> -scala> defined class S - -scala> fish: S = fish - -scala> -scala> arr: Array[java.lang.String] = Array(What's, up, doc?) - -scala> -scala> arrInt: Any = Array(1, 2, 3) - -scala> -scala> arrArrInt: Any = Array(Array(1, 2), Array(3, 4)) - -scala> -scala> -scala> defined class Foo - -scala> defined class Bar - -scala> foo2bar: (Foo)Bar - -scala> bar: Bar = Bar(3) - -scala> -scala> -scala> import bar._ - -scala> m: Int = 3 - -scala> -scala> -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> one: Int = 1 - -scala> -scala> -scala> x1: Int = 1 - -scala> x2: Int = 1 - -scala> x3: Int = 1 - -scala> x4: Int = 1 - -scala> x5: Int = 1 - -scala> x6: Int = 1 - -scala> x7: Int = 1 - -scala> x8: Int = 1 - -scala> x9: Int = 1 - -scala> x10: Int = 1 - -scala> x11: Int = 1 - -scala> x12: Int = 1 - -scala> x13: Int = 1 - -scala> x14: Int = 1 - -scala> x15: Int = 1 - -scala> x16: Int = 1 - -scala> x17: Int = 1 - -scala> x18: Int = 1 - -scala> x19: Int = 1 - -scala> x20: Int = 1 - -scala> -scala> two: Int = 2 - -scala> -scala> -scala> -scala> -scala> :1: error: '=' expected but '=>' found. - def x => y => z - ^ - -scala> :1: error: expected start of definition - [1,2,3] - ^ - -scala> -scala> -scala> -scala> | | | | res3: scala.xml.Elem = - - - -scala> -scala> -scala> | | | | -scala> -scala> -scala> -scala> | | | res4: java.lang.String = - - hello - there - - -scala> -scala> | | You typed two blank lines. Starting a new command. - -scala> -scala> match: Int - -scala> x: Int = 1 - -scala> -scala> -scala> defined class Exp -defined class Fact -defined class Term - -scala> | | :15: warning: match is not exhaustive! -missing combination Term - - def f(e: Exp) = e match { // non-exhaustive warning here - ^ -f: (Exp)Int - -scala> -scala> diff --git a/test/files/run/interpreter.scala b/test/files/run/interpreter.scala deleted file mode 100644 index f5ce68a1b9..0000000000 --- a/test/files/run/interpreter.scala +++ /dev/null @@ -1,172 +0,0 @@ -import scala.tools.nsc._ -import java.io.{BufferedReader, StringReader, PrintWriter, - Writer, OutputStreamWriter} - -object Test { - val testCodeString = -// basics -3+4 -def gcd(x: Int, y: Int): Int = {{ - if (x == 0) y - else if (y == 0) x - else gcd(y%x, x) -}} -val five = gcd(15,35) -var x = 1 -x = 2 -val three = x+1 -type anotherint = Int -val four: anotherint = 4 -val bogus: anotherint = "hello" -trait PointlessTrait -val (x,y) = (2,3) -println("hello") - -// ticket #1513 -val t1513 = Array(null) -// ambiguous toString problem from #547 -val atom = new scala.xml.Atom() -// overriding toString problem from #1404 -class S(override val toString : String) -val fish = new S("fish") -// Test that arrays pretty print nicely. -val arr = Array("What's", "up", "doc?") -// Test that arrays pretty print nicely, even when we give them type Any -val arrInt : Any = Array(1,2,3) -// Test that nested arrays are pretty-printed correctly -val arrArrInt : Any = Array(Array(1, 2), Array(3, 4)) - -// implicit conversions -case class Foo(n: Int) -case class Bar(n: Int) -implicit def foo2bar(foo: Foo) = Bar(foo.n) -val bar: Bar = Foo(3) - -// importing from a previous result -import bar._ -val m = n - -// stressing the imports mechanism -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 -val one = 1 - - -val x1 = 1 -val x2 = 1 -val x3 = 1 -val x4 = 1 -val x5 = 1 -val x6 = 1 -val x7 = 1 -val x8 = 1 -val x9 = 1 -val x10 = 1 -val x11 = 1 -val x12 = 1 -val x13 = 1 -val x14 = 1 -val x15 = 1 -val x16 = 1 -val x17 = 1 -val x18 = 1 -val x19 = 1 -val x20 = 1 - -val two = one + x5 - - -// interior syntax errors should *not* go into multi-line input mode. -// both of the following should abort immediately: -def x => y => z -[1,2,3] - - -// multi-line XML -<a> -<b - c="c" - d="dd" -/></a> - - -/* - /* - multi-line comment - */ -*/ - - -// multi-line string -""" -hello -there -""" - -(1 + // give up early by typing two blank lines - - -// defining and using quoted names should work (ticket #323) -def `match` = 1 -val x = `match` - -// multiple classes defined on one line -sealed class Exp; class Fact extends Exp; class Term extends Exp -def f(e: Exp) = e match {{ // non-exhaustive warning here - case _:Fact => 3 -}} - -.text - - /** A writer that skips the first line of text. The first - * line of interpreter output is skipped because it includes - * a version number. */ - class Skip1Writer(writer: Writer) extends Writer { - var seenNL = false - - def write(cbuf: Array[Char], off: Int, len: Int) { - if (seenNL) - writer.write(cbuf, off, len) - else { - val slice : Array[Char] = cbuf.slice(off, off+len) - val i = slice.indexOf('\n') - if (i >= 0) { - seenNL = true - writer.write(slice, i+1, slice.length-(i+1)) - } else { - // skip it - } - } - } - - def close() { writer.close() } - def flush() { writer.flush() } - } - - - def main(args: Array[String]) { - val input = new BufferedReader(new StringReader(testCodeString)) - val output = new PrintWriter( - new Skip1Writer(new OutputStreamWriter(Console.out))) - val repl = new InterpreterLoop(input, output) - repl.main(new Settings) - println() - } -} -- cgit v1.2.3