summaryrefslogtreecommitdiff
path: root/test/disabled/run/script-positions.scala
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2017-03-20 17:13:56 -0700
committerSeth Tisue <seth@tisue.net>2017-03-20 17:24:33 -0700
commit25048bc73741846107c18ed01e0e9f6f07785379 (patch)
treec1c9d60002fec74fc13af354e51bb3d688b33902 /test/disabled/run/script-positions.scala
parent0563c4b23cdc7ed6c05e9defe2a675df4d838347 (diff)
downloadscala-25048bc73741846107c18ed01e0e9f6f07785379.tar.gz
scala-25048bc73741846107c18ed01e0e9f6f07785379.tar.bz2
scala-25048bc73741846107c18ed01e0e9f6f07785379.zip
rm -r test/{flaky,disabled*,checker-tests,support,debug}
keeping this stuff, somewhere, forever and ever and ever is what version control is for. who dares disturb the ancient and accursed tomb of all this code...?
Diffstat (limited to 'test/disabled/run/script-positions.scala')
-rw-r--r--test/disabled/run/script-positions.scala86
1 files changed, 0 insertions, 86 deletions
diff --git a/test/disabled/run/script-positions.scala b/test/disabled/run/script-positions.scala
deleted file mode 100644
index 2c80d550c0..0000000000
--- a/test/disabled/run/script-positions.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-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")
- )
- }
- }
-}