summaryrefslogtreecommitdiff
path: root/test/files/run/bug0325.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-24 17:11:55 +0000
committerPaul Phillips <paulp@improving.org>2011-08-24 17:11:55 +0000
commitb9785280a7138a2bb52060faf94807aa0d07dec1 (patch)
tree870cc1930ac3d50cd07078260f58984224dd39a5 /test/files/run/bug0325.scala
parent84fcf633d9ca507124806d64729cb8463bcebb69 (diff)
downloadscala-b9785280a7138a2bb52060faf94807aa0d07dec1.tar.gz
scala-b9785280a7138a2bb52060faf94807aa0d07dec1.tar.bz2
scala-b9785280a7138a2bb52060faf94807aa0d07dec1.zip
Renamed tests named bugXXX to tXXX, no review.
Diffstat (limited to 'test/files/run/bug0325.scala')
-rw-r--r--test/files/run/bug0325.scala53
1 files changed, 0 insertions, 53 deletions
diff --git a/test/files/run/bug0325.scala b/test/files/run/bug0325.scala
deleted file mode 100644
index 236f1b101f..0000000000
--- a/test/files/run/bug0325.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-case class RS(self: String) {
-
- // NB. "\\Q" + '\\' + "\\E" works on Java 1.5 and newer, but not on Java 1.4
- private def escape(ch: Char): String = ch match {
- case '\\' => "\\\\"
- case _ => "\\Q"+ch+"\\E"
- }
-
- def split(separator: Char): Array[String] = self.split(escape(separator))
-
- def split(separators: Array[Char]): Array[String] = {
- val re = separators.foldLeft("[")(_+escape(_)) + "]"
- self.split(re)
- }
-}
-
-object Test {
- def expect = List("a","b")
- def test(f: => Array[String], which: String) {
- try {
- val ret = f.toList
- if (ret != expect)
- println(which + " returned " + ret + " when expecting " + expect)
- else
- println(ret)
- } catch {
- case e@_ => println(which + " failed with " + e.getClass)
- }
- }
-
- def main(args: Array[String]) {
- val badChars = "?*{+([\\^.$"
-
- for (c <- badChars)
- test(("a"+c+"b").split(c),"RichString split('"+ c + "')")
- println
-
- for (c <- badChars)
- test(RS("a"+c+"b").split(c),"RS split('"+ c + "')")
- println
-
- val badCases = List(
- ']' -> "x]", '&' -> "&&",'\\' -> "\\x", '[' -> "[x",
- '^' -> "^x", '-' -> "x-z"
- )
- for ((c,str) <- badCases)
- test(("a"+c+"b").split(str.toArray),"RichString split(\""+ str + "\")")
- println
-
- for ((c,str) <- badCases)
- test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")")
- }
-}