summaryrefslogtreecommitdiff
path: root/test/files/run/t6631.scala
blob: e472b83d50a60f794884f7d2859a6972d27496ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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"\")

}