diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-02 00:15:50 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-02 00:15:50 -0800 |
commit | 6c63ab153651f7946ece5740d52e0f2b701e349d (patch) | |
tree | dd52a24ff707a808a9b646259f4e508f61c3b7ab /test | |
parent | 6ff3c3fd6a238391d0c82599e25731c708bf0e03 (diff) | |
parent | 32b756494e7a6316156e6915827ac986b91b3997 (diff) | |
download | scala-6c63ab153651f7946ece5740d52e0f2b701e349d.tar.gz scala-6c63ab153651f7946ece5740d52e0f2b701e349d.tar.bz2 scala-6c63ab153651f7946ece5740d52e0f2b701e349d.zip |
Merge pull request #3207 from retronym/ticket/8022
SI-8022 Backwards compatibility for Regex#unapplySeq
Diffstat (limited to 'test')
-rw-r--r-- | test/junit/scala/util/matching/RegexTest.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/junit/scala/util/matching/RegexTest.scala b/test/junit/scala/util/matching/RegexTest.scala new file mode 100644 index 0000000000..d25842cc57 --- /dev/null +++ b/test/junit/scala/util/matching/RegexTest.scala @@ -0,0 +1,30 @@ + +package scala.util.matching + +import org.junit.Assert._ +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(classOf[JUnit4]) +class RegexTest { + @Test def t8022CharSequence(): Unit = { + val full = """.*: (.)$""".r + val text = " When I use this operator: *" + // Testing 2.10.x compatibility of the return types of unapplySeq + val x :: Nil = full.unapplySeq(text: Any).get + val y :: Nil = full.unapplySeq(text: CharSequence).get + assertEquals("*", x) + assertEquals("*", y) + } + + @Test def t8022Match(): Unit = { + val R = """(\d)""".r + val matchh = R.findFirstMatchIn("a1").get + // Testing 2.10.x compatibility of the return types of unapplySeq + val x :: Nil = R.unapplySeq(matchh: Any).get + val y :: Nil = R.unapplySeq(matchh).get + assertEquals("1", x) + assertEquals("1", y) + } +} |