summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-01-30 16:11:00 +0000
committermichelou <michelou@epfl.ch>2008-01-30 16:11:00 +0000
commit817317824a1c62eabd9e09b7d2e98494292d8695 (patch)
tree32948c775ffebed636315286074a057a9d35882f /test/files
parent1dda54121ee66cb5251cfa3145e167529a9301de (diff)
downloadscala-817317824a1c62eabd9e09b7d2e98494292d8695.tar.gz
scala-817317824a1c62eabd9e09b7d2e98494292d8695.tar.bz2
scala-817317824a1c62eabd9e09b7d2e98494292d8695.zip
forget to ci test file (regexp pattern)
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/bug0325.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/files/run/bug0325.scala b/test/files/run/bug0325.scala
index dc05a8d777..236f1b101f 100644
--- a/test/files/run/bug0325.scala
+++ b/test/files/run/bug0325.scala
@@ -1,8 +1,15 @@
case class RS(self: String) {
- def split(separator: Char): Array[String] = self.split("\\Q"+separator+"\\E")
+
+ // 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("[")(_+"\\Q"+_+"\\E") + "]"
+ val re = separators.foldLeft("[")(_+escape(_)) + "]"
self.split(re)
}
}