diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/repl-paste-b.check | 14 | ||||
-rw-r--r-- | test/files/run/repl-paste-b.scala | 13 | ||||
-rw-r--r-- | test/files/run/repl-paste-raw-b.pastie | 8 | ||||
-rw-r--r-- | test/files/run/repl-paste-raw-b.scala | 18 | ||||
-rw-r--r-- | test/files/run/repl-paste-raw-c.pastie | 5 | ||||
-rw-r--r-- | test/files/run/repl-paste-raw-c.scala | 16 | ||||
-rw-r--r-- | test/files/run/repl-paste-raw.pastie | 4 | ||||
-rw-r--r-- | test/files/run/repl-paste-raw.scala | 2 |
8 files changed, 77 insertions, 3 deletions
diff --git a/test/files/run/repl-paste-b.check b/test/files/run/repl-paste-b.check new file mode 100644 index 0000000000..2e205d48d6 --- /dev/null +++ b/test/files/run/repl-paste-b.check @@ -0,0 +1,14 @@ + +scala> :paste < EOF +// Entering paste mode (EOF to finish) + +object X +EOF + +// Exiting paste mode, now interpreting. + +defined object X + +scala> assert(X.getClass.getName.contains("line")) + +scala> :quit diff --git a/test/files/run/repl-paste-b.scala b/test/files/run/repl-paste-b.scala new file mode 100644 index 0000000000..718f7d9e17 --- /dev/null +++ b/test/files/run/repl-paste-b.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +// confirm X not in empty package +object Test extends ReplTest { + def code = + """ +:paste < EOF +object X +EOF +assert(X.getClass.getName.contains("line")) +""" + +} diff --git a/test/files/run/repl-paste-raw-b.pastie b/test/files/run/repl-paste-raw-b.pastie new file mode 100644 index 0000000000..f13b4bcf8b --- /dev/null +++ b/test/files/run/repl-paste-raw-b.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-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" +} diff --git a/test/files/run/repl-paste-raw-c.pastie b/test/files/run/repl-paste-raw-c.pastie new file mode 100644 index 0000000000..364d8cef4b --- /dev/null +++ b/test/files/run/repl-paste-raw-c.pastie @@ -0,0 +1,5 @@ + +// not actually a candidate for raw paste + +val nope = 42 + diff --git a/test/files/run/repl-paste-raw-c.scala b/test/files/run/repl-paste-raw-c.scala new file mode 100644 index 0000000000..600ac4d2f0 --- /dev/null +++ b/test/files/run/repl-paste-raw-c.scala @@ -0,0 +1,16 @@ + +import scala.tools.partest.SessionTest + +object Test extends SessionTest { + def session = +s"""| + |scala> :paste -raw $pastie + |Pasting file $pastie... + |$pastie:3: error: expected class or object definition + |val nope = 42 + |^ + |There were compilation errors! + | + |scala> :quit""" + def pastie = testPath changeExtension "pastie" +} diff --git a/test/files/run/repl-paste-raw.pastie b/test/files/run/repl-paste-raw.pastie index f13b4bcf8b..a4a570aaa2 100644 --- a/test/files/run/repl-paste-raw.pastie +++ b/test/files/run/repl-paste-raw.pastie @@ -1,8 +1,8 @@ +package brown_paper + // 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 index 9bd5e8e63e..d1c7692f2f 100644 --- a/test/files/run/repl-paste-raw.scala +++ b/test/files/run/repl-paste-raw.scala @@ -4,7 +4,7 @@ import scala.tools.partest.SessionTest object Test extends SessionTest { def session = s"""| - |scala> :paste -raw $pastie + |scala> :paste $pastie |Pasting file $pastie... | |scala> val favoriteThing = brown_paper.Gift(true) |