summaryrefslogtreecommitdiff
path: root/test/files/run/t7747-repl.scala
diff options
context:
space:
mode:
authorPrashant Sharma <prashant.s@imaginea.com>2013-09-25 15:27:13 +0530
committerSom Snytt <som.snytt@gmail.com>2013-11-10 23:14:02 -0800
commit1f834cdc9be78c2a6850044a9db24d461b5151ec (patch)
treebfec6675b047a204796b51cdbe814e3a81fd8071 /test/files/run/t7747-repl.scala
parent7ecfce1fb8d39275f082aaa3ad4dc0eee197391c (diff)
downloadscala-1f834cdc9be78c2a6850044a9db24d461b5151ec.tar.gz
scala-1f834cdc9be78c2a6850044a9db24d461b5151ec.tar.bz2
scala-1f834cdc9be78c2a6850044a9db24d461b5151ec.zip
SI-7747 Support class based wrappers as alternative through switch -Yrepl-class-based
Refactoring to reduce the number of if-else Fix test.
Diffstat (limited to 'test/files/run/t7747-repl.scala')
-rw-r--r--test/files/run/t7747-repl.scala69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/files/run/t7747-repl.scala b/test/files/run/t7747-repl.scala
new file mode 100644
index 0000000000..0e64210460
--- /dev/null
+++ b/test/files/run/t7747-repl.scala
@@ -0,0 +1,69 @@
+import scala.tools.partest.ReplTest
+import scala.tools.nsc.Settings
+
+object Test extends ReplTest {
+
+ override def transformSettings(s: Settings): Settings = {
+ s.Yreplclassbased.value = true
+ s
+ }
+
+ def code = """
+ |var x = 10
+ |var y = 11
+ |x = 12
+ |y = 13
+ |val z = x * y
+ |2 ; 3
+ |{ 2 ; 3 }
+ |5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = {
+ | 1 +
+ | 2 +
+ | 3 } ; bippy+88+11
+ |
+ |object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy
+ |Bovine.x = List(Ruminant(5), Cow, new Moo)
+ |Bovine.x
+ |
+ |(2)
+ |(2 + 2)
+ |((2 + 2))
+ | ((2 + 2))
+ | ( (2 + 2))
+ | ( (2 + 2 ) )
+ |5 ; ( (2 + 2 ) ) ; ((5))
+ |(((2 + 2)), ((2 + 2)))
+ |(((2 + 2)), ((2 + 2)), 2)
+ |(((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3)).mkString)
+ |
+ |55 ; ((2 + 2)) ; (1, 2, 3)
+ |55 ; (x: Int) => x + 1 ; () => ((5))
+ |
+ |() => 5
+ |55 ; () => 5
+ |() => { class X ; new X }
+ |
+ |def foo(x: Int)(y: Int)(z: Int) = x+y+z
+ |foo(5)(10)(15)+foo(5)(10)(15)
+ |
+ |List(1) ++ List('a')
+ |
+ |1 to 100 map (_ + 1)
+ |val x1 = 1
+ |val x2 = 2
+ |val x3 = 3
+ |case class BippyBungus()
+ |x1 + x2 + x3
+ |:reset
+ |x1 + x2 + x3
+ |val x1 = 4
+ |new BippyBungus
+ |class BippyBungus() { def f = 5 }
+ |{ new BippyBungus ; x1 }
+ |object x {class y { case object z } }
+ |case class BippyBups()
+ |case class PuppyPups()
+ |case class Bingo()
+ |List(BippyBups(), PuppyPups(), Bingo()) // show
+ |""".stripMargin
+}