summaryrefslogtreecommitdiff
path: root/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
diff options
context:
space:
mode:
authorDen Shabalin <den.shabalin@gmail.com>2013-07-08 20:21:33 +0200
committerEugene Burmako <xeno.by@gmail.com>2013-07-08 21:20:28 +0200
commit7553b0afa9e4a071c7ea1cd51effd57030b66be6 (patch)
tree0bdbf723ecf823e07c942c922d73a9ad768363c2 /test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
parent17719231c615c06eb83f4109f53bfdd948a6fdb1 (diff)
downloadscala-7553b0afa9e4a071c7ea1cd51effd57030b66be6.tar.gz
scala-7553b0afa9e4a071c7ea1cd51effd57030b66be6.tar.bz2
scala-7553b0afa9e4a071c7ea1cd51effd57030b66be6.zip
tests for quasiquotes
Introduces an extensive ScalaCheck-based test suite for recently implemented quasiquotes. Provides tools for syntactic tree comparison and verifying compilation error messages.
Diffstat (limited to 'test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala')
-rw-r--r--test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
new file mode 100644
index 0000000000..f73fd29b22
--- /dev/null
+++ b/test/files/scalacheck/quasiquotes/PatternDeconstructionProps.scala
@@ -0,0 +1,35 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+
+import scala.reflect.runtime.universe._
+import Flag._
+import definitions._
+
+object PatternDeconstructionProps extends QuasiquoteProperties("pattern deconstruction") {
+ property("extract bind") = forAll { (bind: Bind) =>
+ val pq"$bind0" = pq"$bind"
+ bind0 ≈ bind
+ }
+
+ property("extract bind and subpattern") = forAll { (name: TermName, subp: Tree) =>
+ val pq"$name0 @ $subp0" = pq"$name @ $subp"
+ name0 ≈ name && subp0 ≈ subp
+ }
+
+ property("extract typed") = forAll { (typ: Tree) =>
+ val pq"_ : $typ0" = pq"_ : $typ"
+ typ0 ≈ typ
+ }
+
+ property("extract apply") = forAll { (pat: Tree, subpat: Tree) =>
+ val pq"$pat0($subpat0)" = pq"$pat($subpat)"
+ pat0 ≈ pat && subpat0 ≈ subpat
+ }
+
+ property("extract casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) =>
+ val cq"$pat0 if $cond0 => $body0" = cq"$pat if $cond => $body"
+ pat0 ≈ pat && cond0 ≈ cond && body0 ≈ body
+ }
+} \ No newline at end of file