diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-12-02 19:14:02 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-12-02 19:17:58 +0100 |
commit | 7ee1145d4502396816da3fb0155960524de94079 (patch) | |
tree | a876c04cc2466b561e8146aac6dff1e127688573 /test/files | |
parent | f16f4ab157293ac6860d4b00578b983c90b8fc62 (diff) | |
download | scala-7ee1145d4502396816da3fb0155960524de94079.tar.gz scala-7ee1145d4502396816da3fb0155960524de94079.tar.bz2 scala-7ee1145d4502396816da3fb0155960524de94079.zip |
SI-6631 Handle invalid escapes in string interpolators
Patch contributed by Rex Kerr.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t6631.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t6631.scala b/test/files/run/t6631.scala new file mode 100644 index 0000000000..e472b83d50 --- /dev/null +++ b/test/files/run/t6631.scala @@ -0,0 +1,18 @@ +import reflect.ClassTag + +object Test extends App { + def intercept[T <: Throwable : ClassTag](act: => Any) = try { + act + } catch { + case x: Throwable => + val cls = implicitly[ClassTag[T]].runtimeClass + assert(cls.isInstance(x), (x.getClass, x, cls).toString) + } + assert(s"""\f\r\n\t""" == "\f\r\n\t") + + import StringContext.InvalidEscapeException + intercept[InvalidEscapeException](s"""\""") + intercept[InvalidEscapeException](s"""\x""") + intercept[InvalidEscapeException](s"\") + +} |