summaryrefslogtreecommitdiff
path: root/test/files/scalacheck
diff options
context:
space:
mode:
authorDen Shabalin <den.shabalin@gmail.com>2013-09-05 20:41:48 +0200
committerDen Shabalin <den.shabalin@gmail.com>2013-09-05 20:42:10 +0200
commit546e94099d667c6395582fcba321ef95578121a5 (patch)
tree6c250294e163c0aa008d117b5e994003174857fe /test/files/scalacheck
parent1352fea1c4ecfa0fd66ff1d5ad6e0ee437b1a59f (diff)
downloadscala-546e94099d667c6395582fcba321ef95578121a5.tar.gz
scala-546e94099d667c6395582fcba321ef95578121a5.tar.bz2
scala-546e94099d667c6395582fcba321ef95578121a5.zip
SI-7803 support for matching of anonymous function literals
Diffstat (limited to 'test/files/scalacheck')
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala10
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala9
2 files changed, 18 insertions, 1 deletions
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index 599dfd442a..c6cca85c81 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -157,4 +157,14 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
val empty = List[Tree]()
assert(q"(..$empty)" ≈ q"()")
}
+
+ property("function param flags are the same") = test {
+ val xy = q"val x: A" :: q"val y: B" :: Nil
+ assertEqAst(q"(..$xy) => x + y", "(x: A, y: B) => x + y")
+ }
+
+ property("anonymous functions don't support default values") = test {
+ val x = q"val x: Int = 1"
+ assertThrows[IllegalArgumentException] { q"($x) => x" }
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 6087bbdb74..762625a46a 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -67,4 +67,11 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
val q"{ ..$xs }" = q"{ x1; x2; x3 }"
assert(xs ≈ List(q"x1", q"x2", q"x3"))
}
-} \ No newline at end of file
+
+ property("exhaustive function matcher") = test {
+ def matches(line: String) { val q"(..$args) => $body" = parse(line) }
+ matches("() => bippy")
+ matches("(y: Y) => y oh y")
+ matches("(x: X, y: Y) => x and y")
+ }
+}