Rename methods in Regex. Add matchEntire method to match entire string against regex.
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ internal fun getUsedMemoryKb(): Long {
|
||||
private fun comparableVersionStr(version: String) =
|
||||
"(\\d+)\\.(\\d+).*"
|
||||
.toRegex()
|
||||
.match(version)
|
||||
.find(version)
|
||||
?.groups
|
||||
?.drop(1)?.take(2)
|
||||
// checking if two subexpression groups are found and length of each is >0 and <4
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class KotlinGradleIT: BaseGradleIT() {
|
||||
for (i in 1..3) {
|
||||
project.build(userVariantArg, "build", options = BaseGradleIT.BuildOptions(withDaemon = true)) {
|
||||
assertSuccessful()
|
||||
val matches = "\\[PERF\\] Used memory after build: (\\d+) kb \\(([+-]?\\d+) kb\\)".toRegex().match(output)
|
||||
val matches = "\\[PERF\\] Used memory after build: (\\d+) kb \\(([+-]?\\d+) kb\\)".toRegex().find(output)
|
||||
assert(matches != null && matches.groups.size() == 3, "Used memory after build is not reported by plugin")
|
||||
val reportedGrowth = matches!!.groups.get(2)!!.value.removePrefix("+").toInt()
|
||||
assert(reportedGrowth <= 700, "Used memory growth $reportedGrowth > 700")
|
||||
|
||||
Reference in New Issue
Block a user