summaryrefslogtreecommitdiff
path: root/test/disabled
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-05-26 14:14:12 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-05-26 14:14:12 +0000
commite239d7fa5b9de5edffb06022c4cc5a9c105a51d3 (patch)
tree5aac86ae523db164174e39c900a5d2c5ad094075 /test/disabled
parentc932ec58f9e6fc90c9497bb4cbfb09f2b398e7ea (diff)
downloadscala-e239d7fa5b9de5edffb06022c4cc5a9c105a51d3.tar.gz
scala-e239d7fa5b9de5edffb06022c4cc5a9c105a51d3.tar.bz2
scala-e239d7fa5b9de5edffb06022c4cc5a9c105a51d3.zip
svnmerge + tags
Diffstat (limited to 'test/disabled')
-rw-r--r--test/disabled/pos/bug2919.scala12
-rw-r--r--test/disabled/run/script-positions.scala86
2 files changed, 98 insertions, 0 deletions
diff --git a/test/disabled/pos/bug2919.scala b/test/disabled/pos/bug2919.scala
new file mode 100644
index 0000000000..5e51cf9de7
--- /dev/null
+++ b/test/disabled/pos/bug2919.scala
@@ -0,0 +1,12 @@
+import javax.xml.bind.annotation.adapters.XmlAdapter
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter
+
+case class Link(
+ @XmlJavaTypeAdapter(classOf[StringOptionAdapter]) val title: Option[String]
+)
+
+class StringOptionAdapter extends XmlAdapter[String, Option[String]] {
+ def unmarshal(str: String) = error("stub")
+ def marshal(op: Option[String]) = error("Stub")
+}
+
diff --git a/test/disabled/run/script-positions.scala b/test/disabled/run/script-positions.scala
new file mode 100644
index 0000000000..6982ed8440
--- /dev/null
+++ b/test/disabled/run/script-positions.scala
@@ -0,0 +1,86 @@
+import scala.tools.nsc._
+import util.stringFromStream
+
+// Testing "scripts" without the platform delights which accompany actual scripts.
+object Scripts {
+
+ val test1 =
+"""#!/bin/sh
+ exec scala $0 $@
+!#
+
+println("statement 1")
+println("statement 2".thisisborked)
+println("statement 3")
+"""
+
+ val output1 =
+"""thisisborked.scala:6: error: value thisisborked is not a member of java.lang.String
+println("statement 2".thisisborked)
+ ^
+one error found"""
+ val test2 =
+"""#!scala
+// foo
+// bar
+!#
+
+val x = "line 6"
+val y = "line 7"
+val z "line 8""""
+
+ val output2 =
+"""bob.scala:8: error: '=' expected but string literal found.
+val z "line 8"
+ ^
+bob.scala:8: error: illegal start of simple expression
+val z "line 8"
+ ^
+two errors found"""
+}
+
+object Test {
+ import Scripts._
+
+ def settings = new GenericRunnerSettings(println _)
+ settings.nocompdaemon.value = true
+
+ def runScript(code: String): String =
+ stringFromStream(stream =>
+ Console.withOut(stream) {
+ Console.withErr(stream) {
+ ScriptRunner.runCommand(settings, code, Nil)
+ }
+ }
+ )
+
+ val tests: List[(String, String)] = List(
+ test1 -> output1,
+ test2 -> output2
+ )
+ // def lines(s: String) = s split """\r\n|\r|\n""" toList
+ def lines(s: String) = s split "\\n" toList
+
+ // strip the random temp filename from error msgs
+ def stripFilename(s: String) = (s indexOf ".scala:") match {
+ case -1 => s
+ case idx => s drop (idx + 7)
+ }
+ def toLines(text: String) = lines(text) map stripFilename
+
+ def main(args: Array[String]): Unit = {
+ for ((code, expected) <- tests) {
+ val out = toLines(runScript(code))
+ val exp = toLines(expected)
+ val nomatch = out zip exp filter { case (x, y) => x != y }
+ val success = out.size == exp.size && nomatch.isEmpty
+
+ assert(
+ success,
+ "Output doesn't match expected:\n" +
+ "Expected:\n" + expected +
+ "Actual:\n" + out.mkString("\n")
+ )
+ }
+ }
+}