summaryrefslogtreecommitdiff
path: root/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/scalacheck/quasiquotes/PatternConstructionProps.scala')
-rw-r--r--test/files/scalacheck/quasiquotes/PatternConstructionProps.scala37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
new file mode 100644
index 0000000000..aee50c9c5f
--- /dev/null
+++ b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
@@ -0,0 +1,37 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+
+import scala.reflect.runtime.universe._
+import Flag._
+
+object PatternConstructionProps extends QuasiquoteProperties("pattern construction") {
+ property("splice bind") = forAll { (bind: Bind) =>
+ pq"$bind" ≈ bind
+ }
+
+ property("splice name into bind") = forAll { (name: TermName) =>
+ pq"$name" ≈ Bind(name, Ident(nme.WILDCARD))
+ }
+
+ property("splice name and tree into bind") = forAll { (name: TermName, tree: Tree) =>
+ pq"$name @ $tree" ≈ Bind(name, tree)
+ }
+
+ property("splice type name into typed") = forAll { (name: TypeName) =>
+ pq"_ : $name" ≈ Typed(Ident(nme.WILDCARD), Ident(name))
+ }
+
+ property("splice tree into typed") = forAll { (typ: Tree) =>
+ pq"_ : $typ" ≈ Typed(Ident(nme.WILDCARD), typ)
+ }
+
+ property("splice into apply") = forAll { (pat: Tree, subpat: Tree) =>
+ pq"$pat($subpat)" ≈ Apply(pat, List(subpat))
+ }
+
+ property("splice into casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) =>
+ cq"$pat if $cond => $body" ≈ CaseDef(pat, cond, Block(List(), body))
+ }
+} \ No newline at end of file