summaryrefslogtreecommitdiff
path: root/test/scalacheck/t2460.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/scalacheck/t2460.scala')
-rw-r--r--test/scalacheck/t2460.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/scalacheck/t2460.scala b/test/scalacheck/t2460.scala
new file mode 100644
index 0000000000..42ff3ecfe6
--- /dev/null
+++ b/test/scalacheck/t2460.scala
@@ -0,0 +1,27 @@
+import org.scalacheck.Prop.forAll
+import org.scalacheck.Properties
+import org.scalacheck.{Test => SCTest}
+import org.scalacheck.Gen
+
+object SI2460Test extends Properties("Regex : Ticket 2460") {
+
+ val vowel = Gen.oneOf("a", "z")
+
+ val numberOfMatch = forAll(vowel) {
+ (s: String) => "\\s*([a-z])\\s*".r("data").findAllMatchIn((1 to 20).map(_ => s).mkString).size == 20
+ }
+
+ val numberOfGroup = forAll(vowel) {
+ (s: String) => "\\s*([a-z])\\s*([a-z])\\s*".r("data").findAllMatchIn((1 to 20).map(_ => s).mkString).next.groupCount == 2
+ }
+
+ val nameOfGroup = forAll(vowel) {
+ (s: String) => "([a-z])".r("data").findAllMatchIn(s).next.group("data") == s
+ }
+
+ val tests = List(
+ ("numberOfMatch", numberOfMatch),
+ ("numberOfGroup", numberOfGroup),
+ ("nameOfGroup", nameOfGroup)
+ )
+}