summaryrefslogtreecommitdiff
path: root/test/files/scalacheck/quasiquotes/TypeConstructionProps.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/TypeConstructionProps.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/TypeConstructionProps.scala')
-rw-r--r--test/files/scalacheck/quasiquotes/TypeConstructionProps.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
new file mode 100644
index 0000000000..535ed8ecbf
--- /dev/null
+++ b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
@@ -0,0 +1,25 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+
+import scala.reflect.runtime.universe._
+import Flag._
+
+object TypeConstructionProps extends QuasiquoteProperties("type construction") {
+ property("bare idents contain type names") = test {
+ tq"x" ≈ Ident(TypeName("x"))
+ }
+
+ property("splice type names into AppliedTypeTree") = forAll { (name1: TypeName, name2: TypeName) =>
+ tq"$name1[$name2]" ≈ AppliedTypeTree(Ident(name1), List(Ident(name2)))
+ }
+
+ property("tuple type") = test {
+ val empty = List[Tree]()
+ val ts = List(tq"t1", tq"t2")
+ assert(tq"(..$empty)" ≈ tq"scala.Unit")
+ assert(tq"(..$ts)" ≈ tq"Tuple2[t1, t2]")
+ assert(tq"(t0, ..$ts)" ≈ tq"Tuple3[t0, t1, t2]")
+ }
+} \ No newline at end of file