diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-09-06 13:14:03 +0200 |
---|---|---|
committer | Den Shabalin <den.shabalin@gmail.com> | 2013-09-11 16:07:07 +0200 |
commit | 5607bd137d8a22c6933e3692a4a1626928acf67f (patch) | |
tree | 8e8f65da96ba2dafc29d9955e1c5eb7c62b1e130 /test/files/scalacheck | |
parent | 545ee297e785eb1092376f99f548e523b4d75831 (diff) | |
download | scala-5607bd137d8a22c6933e3692a4a1626928acf67f.tar.gz scala-5607bd137d8a22c6933e3692a4a1626928acf67f.tar.bz2 scala-5607bd137d8a22c6933e3692a4a1626928acf67f.zip |
SI-7304 improve deprecation warnings for tree factory methods
Diffstat (limited to 'test/files/scalacheck')
-rw-r--r-- | test/files/scalacheck/quasiquotes/DeprecationProps.scala | 52 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/Test.scala | 3 |
2 files changed, 54 insertions, 1 deletions
diff --git a/test/files/scalacheck/quasiquotes/DeprecationProps.scala b/test/files/scalacheck/quasiquotes/DeprecationProps.scala new file mode 100644 index 0000000000..8e1601cf9d --- /dev/null +++ b/test/files/scalacheck/quasiquotes/DeprecationProps.scala @@ -0,0 +1,52 @@ +import org.scalacheck._, Prop._, Gen._, Arbitrary._ +import scala.reflect.runtime.universe._ + +object DeprecationProps extends QuasiquoteProperties("deprecation") { + val tname = TypeName("Foo") + val tpt = tq"Foo" + val tpe = typeOf[Int] + val sym = tpe.typeSymbol.asType + val argss = List(q"x") :: List(q"y") :: Nil + val args = q"x" :: q"y" :: Nil + + property("new tpt argss") = test { + assert(q"new $tpt(...$argss)" ≈ New(tpt, argss)) + } + + property("new tpe args") = test { + assert(q"new $tpe(..$args)" ≈ New(tpe, args: _*)) + } + + property("new tpe args") = test { + assert(q"new ${sym.toType}(..$args)" ≈ New(sym, args: _*)) + } + + property("apply sym args") = test { + assert(q"$sym(..$args)" ≈ Apply(sym, args: _*)) + } + + property("applyconstructor") = test { + assert(q"new $tpt(..$args)" ≈ ApplyConstructor(tpt, args)) + } + + property("super sym name") = test { + assert(q"$sym.super[$tname].x".qualifier ≈ Super(sym, tname)) + } + + property("throw tpe args") = test { + assert(q"throw new $tpe(..$args)" ≈ Throw(tpe, args: _*)) + } + + property("casedef pat body") = test { + val pat = pq"foo" + val body = q"bar" + assert(cq"$pat => $body" ≈ CaseDef(pat, body)) + } + + property("try body cases") = test { + val cases = (pq"a", q"b") :: (pq"c", q"d") :: Nil + val newcases = cases.map { case (pat, body) => cq"$pat => $body" } + val body = q"foo" + assert(q"try $body catch { case ..$newcases }" ≈ Try(body, cases: _*)) + } +}
\ No newline at end of file diff --git a/test/files/scalacheck/quasiquotes/Test.scala b/test/files/scalacheck/quasiquotes/Test.scala index 05097711ef..f41d961888 100644 --- a/test/files/scalacheck/quasiquotes/Test.scala +++ b/test/files/scalacheck/quasiquotes/Test.scala @@ -11,4 +11,5 @@ object Test extends Properties("quasiquotes") { include(ErrorProps) include(DefinitionConstructionProps) include(DefinitionDeconstructionProps) -}
\ No newline at end of file + include(DeprecationProps) +} |