summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-07-12 11:42:29 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-07-12 11:42:29 -0700
commit03e4ae59b6b92f128ed3f06c8aa318eb89d61dae (patch)
treed26e01859b3808b62e8f6654bcf697f178a21ed5 /test
parent97f3835acdcb61a492087f6fddc090e704001c75 (diff)
parente7468f3a1aaae7ac4a763226f0a2b9a7a375f493 (diff)
downloadscala-03e4ae59b6b92f128ed3f06c8aa318eb89d61dae.tar.gz
scala-03e4ae59b6b92f128ed3f06c8aa318eb89d61dae.tar.bz2
scala-03e4ae59b6b92f128ed3f06c8aa318eb89d61dae.zip
Merge pull request #2725 from som-snytt/topic/repl-paste-file
SI-4684 Repl supports whole-file paste (rebased)
Diffstat (limited to 'test')
-rw-r--r--test/files/run/repl-paste-4.pastie4
-rw-r--r--test/files/run/repl-paste-4.scala20
-rw-r--r--test/files/run/repl-paste-raw.pastie8
-rw-r--r--test/files/run/repl-paste-raw.scala20
4 files changed, 52 insertions, 0 deletions
diff --git a/test/files/run/repl-paste-4.pastie b/test/files/run/repl-paste-4.pastie
new file mode 100644
index 0000000000..853a66f6a4
--- /dev/null
+++ b/test/files/run/repl-paste-4.pastie
@@ -0,0 +1,4 @@
+
+// if we are truly companions, I can see your foo
+class Foo { private val foo = 7 }
+object Foo { def apply(f: Foo) = f.foo }
diff --git a/test/files/run/repl-paste-4.scala b/test/files/run/repl-paste-4.scala
new file mode 100644
index 0000000000..0060dc1ff6
--- /dev/null
+++ b/test/files/run/repl-paste-4.scala
@@ -0,0 +1,20 @@
+
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+ def session =
+s"""|Type in expressions to have them evaluated.
+ |Type :help for more information.
+ |
+ |scala> :paste $pastie
+ |Pasting file $pastie...
+ |defined class Foo
+ |defined object Foo
+ |
+ |scala> Foo(new Foo)
+ |res0: Int = 7
+ |
+ |scala> """
+ def pastie = testPath changeExtension "pastie"
+}
+
diff --git a/test/files/run/repl-paste-raw.pastie b/test/files/run/repl-paste-raw.pastie
new file mode 100644
index 0000000000..f13b4bcf8b
--- /dev/null
+++ b/test/files/run/repl-paste-raw.pastie
@@ -0,0 +1,8 @@
+
+// a raw paste is not a script
+// hence it can be packaged
+
+package brown_paper
+
+// these are a few of my favorite things
+case class Gift (hasString: Boolean)
diff --git a/test/files/run/repl-paste-raw.scala b/test/files/run/repl-paste-raw.scala
new file mode 100644
index 0000000000..2953796f99
--- /dev/null
+++ b/test/files/run/repl-paste-raw.scala
@@ -0,0 +1,20 @@
+
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+ def session =
+s"""|Type in expressions to have them evaluated.
+ |Type :help for more information.
+ |
+ |scala> :paste -raw $pastie
+ |Pasting file $pastie...
+ |
+ |scala> val favoriteThing = brown_paper.Gift(true)
+ |favoriteThing: brown_paper.Gift = Gift(true)
+ |
+ |scala> favoriteThing.hasString
+ |res0: Boolean = true
+ |
+ |scala> """
+ def pastie = testPath changeExtension "pastie"
+}