diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-02-06 15:59:00 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-02-06 15:59:00 +0100 |
commit | fa02c15d7033714f94cc8510a3a505d60668bf66 (patch) | |
tree | 3487352459b6631660d19a8fb311ca496d048cfb /test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala | |
parent | 0c16bb0af13c1b30224dcb9de0b88354663d834b (diff) | |
parent | ffc3203c3688b6fc5f47f4043bf3a0090de9d985 (diff) | |
download | scala-fa02c15d7033714f94cc8510a3a505d60668bf66.tar.gz scala-fa02c15d7033714f94cc8510a3a505d60668bf66.tar.bz2 scala-fa02c15d7033714f94cc8510a3a505d60668bf66.zip |
Merge pull request #3458 from densh/si/8173
SI-8173 add support for patterns like init :+ last to quasiquotes
Diffstat (limited to 'test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala')
-rw-r--r-- | test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala index 499f5d6d8e..44f110a3d5 100644 --- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala @@ -13,23 +13,43 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction a ≈ Ident(name1) && b ≈ Ident(name2) } - property("tuple type") = test { + property("tuple type (1)") = test { val tq"(..$empty)" = tq"_root_.scala.Unit" assert(empty.isEmpty) + } + + property("tuple type (2)") = test { val tq"(..$ts)" = tq"(t1, t2)" assert(ts ≈ List(tq"t1", tq"t2")) + } + + property("tuple type (3)") = test { val tq"($head, ..$tail)" = tq"(t0, t1, t2)" - assert(head ≈ tq"t0" && tail ≈ List(tq"t1", tq"t2")) + assert(head ≈ tq"t0") + assert(tail ≈ List(tq"t1", tq"t2")) + } + + property("tuple type (4)") = test { + val tq"(..$init, $last)" = tq"(t0, t1, t2)" + assert(init ≈ List(tq"t0", tq"t1")) + assert(last ≈ tq"t2") } property("refined type") = test { val tq"T { ..$stats }" = tq"T { def foo; val x: Int; type Y = String }" - assert(stats ≈ (q"def foo" :: q"val x: Int" :: q"type Y = String" :: Nil)) + assert(stats ≈ List(q"def foo", q"val x: Int", q"type Y = String")) } - property("function type") = test { + property("function type (1)") = test { val tq"..$argtpes => $restpe" = tq"(A, B) => C" - assert(argtpes ≈ (tq"A" :: tq"B" :: Nil)) + assert(argtpes ≈ List(tq"A", tq"B")) assert(restpe ≈ tq"C") } -}
\ No newline at end of file + + property("function type (2)") = test { + val tq"(..$argtpes, $arglast) => $restpe" = tq"(A, B, C) => D" + assert(argtpes ≈ List(tq"A", tq"B")) + assert(arglast ≈ tq"C") + assert(restpe ≈ tq"D") + } +} |