summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/run/ReplacementMatching.scala11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/files/run/ReplacementMatching.scala b/test/files/run/ReplacementMatching.scala
index 30c525b63c..05040d98a3 100644
--- a/test/files/run/ReplacementMatching.scala
+++ b/test/files/run/ReplacementMatching.scala
@@ -15,18 +15,19 @@ object Test {
def replacementMatching {
val regex = """\$\{(.+?)\}""".r
- val replaced = regex.replaceAllMatchesIn("Replacing: ${main}. And another method: ${foo}.",
+ val replaced = regex.replaceAllIn("Replacing: ${main}. And another method: ${foo}.",
(m: util.matching.Regex.Match) => {
val identifier = m.group(1)
identifier
})
assert(replaced == "Replacing: main. And another method: foo.")
- val regex2 = """\$\{(.+?)\}""".r
- val replaced2 = regex2.replaceAllIn("Replacing: ${main}. And then one more: ${bar}.", (s: String) => {
- "$1"
+ val regex3 = """\$\{(.+?)\}""".r
+ val replaced3 = regex3.replaceSomeIn("Replacing: ${main}. And another: ${foo}.", (m: util.matching.Regex.Match) => {
+ val id = m.group(1)
+ if (id.startsWith("m")) Some(id) else None
})
- assert(replaced2 == "Replacing: main. And then one more: bar.")
+ assert(replaced3 == "Replacing: main. And another: ${foo}.")
}
def groupsMatching {