summaryrefslogtreecommitdiff
path: root/test/files/run/repl-paste-raw-b.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-05-27 14:43:22 -0700
committerSom Snytt <som.snytt@gmail.com>2016-06-02 17:04:31 -0700
commitfe61bcf99c0c10054066f7ff41e4c7f44cf02e5d (patch)
tree341cc2ee54d3f8e07cc52ca6710e916d7b02baf8 /test/files/run/repl-paste-raw-b.scala
parent461c896581a6e16d1b79e91e9322eb2d14dc53d2 (diff)
downloadscala-fe61bcf99c0c10054066f7ff41e4c7f44cf02e5d.tar.gz
scala-fe61bcf99c0c10054066f7ff41e4c7f44cf02e5d.tar.bz2
scala-fe61bcf99c0c10054066f7ff41e4c7f44cf02e5d.zip
SI-9104 Autodetect raw pastage
If `-raw` is not supplied explicitly to REPL `:paste`, see if the code text starts with `package` keyword or else see if it parses to a named package (to cope with leading commentary). In that case, take it as raw. But parse only on suspect comment slash. It's only worth parsing for a package if there's a chance that package keyword is buried behind comments. Small refactors to the `paste` object.
Diffstat (limited to 'test/files/run/repl-paste-raw-b.scala')
-rw-r--r--test/files/run/repl-paste-raw-b.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/repl-paste-raw-b.scala b/test/files/run/repl-paste-raw-b.scala
new file mode 100644
index 0000000000..d1c7692f2f
--- /dev/null
+++ b/test/files/run/repl-paste-raw-b.scala
@@ -0,0 +1,18 @@
+
+import scala.tools.partest.SessionTest
+
+object Test extends SessionTest {
+ def session =
+s"""|
+ |scala> :paste $pastie
+ |Pasting file $pastie...
+ |
+ |scala> val favoriteThing = brown_paper.Gift(true)
+ |favoriteThing: brown_paper.Gift = Gift(true)
+ |
+ |scala> favoriteThing.hasString
+ |res0: Boolean = true
+ |
+ |scala> :quit"""
+ def pastie = testPath changeExtension "pastie"
+}