summaryrefslogtreecommitdiff
path: root/test/files/run/repl-paste-4.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2013-07-01 00:30:16 -0700
committerSom Snytt <som.snytt@gmail.com>2013-07-11 19:06:42 -0700
commit816a444f177b5f2bb90a2e89802d06c26f6a21ff (patch)
tree1d97ae0dad5e415dc6a1d1f36ca29e0a08b765de /test/files/run/repl-paste-4.scala
parent8b41240f3d532c470112d7bf1f409badac4d56aa (diff)
downloadscala-816a444f177b5f2bb90a2e89802d06c26f6a21ff.tar.gz
scala-816a444f177b5f2bb90a2e89802d06c26f6a21ff.tar.bz2
scala-816a444f177b5f2bb90a2e89802d06c26f6a21ff.zip
SI-4684 Repl supports whole-file paste
Add a file argument to the :paste command which loads the file's contents as though entered in :paste mode. The :paste command is replayable. Samples, including companions defined together: ``` scala> :paste junk.scala File contains no code: junk.scala scala> :paste no-file.scala That file does not exist scala> :paste obj-repl.scala Pasting file obj-repl.scala... <console>:2: error: expected start of definition private foo = 7 ^ scala> :paste hw-repl.scala Pasting file hw-repl.scala... The pasted code is incomplete! <pastie>:5: error: illegal start of simple expression } ^ scala> :replay Replaying: :paste junk.scala File contains no code: junk.scala Replaying: :paste obj-repl.scala Pasting file obj-repl.scala... defined trait Foo defined object Foo Replaying: Foo(new Foo{}) res0: Int = 7 ```
Diffstat (limited to 'test/files/run/repl-paste-4.scala')
-rw-r--r--test/files/run/repl-paste-4.scala20
1 files changed, 20 insertions, 0 deletions
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"
+}
+