Skip to content

Commit

Permalink
use specId instead of kclass
Browse files Browse the repository at this point in the history
  • Loading branch information
myuwono committed Oct 23, 2022
1 parent 208b79a commit b9cc276
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -53,9 +53,12 @@ class GradleClassMethodRegexTestFilter(private val patterns: List<String>) : Tes
val path = descriptor.dotSeparatedFullPath().value
val regexPattern = "^(.*)$pattern".toRegex() // matches pattern exactly
val laxRegexPattern = "^(.*)$pattern(.*)\$".toRegex() // matches pattern that can be followed by others
val packagePath = descriptor.spec().kclass.java.packageName // io.kotest
val packagePath = descriptor.spec().id.value.split(".").dropLast(1).joinToString(".") // io.kotest

val isSimpleClassMatch by lazy { descriptor.spec().kclass.java.simpleName.matches(pattern.toRegex()) } // SomeTest or *Test
val isSimpleClassMatch by lazy {
// SomeTest or *Test
descriptor.spec().id.value.split(".").lastOrNull()?.matches(pattern.toRegex()) ?: false
}
val isSpecMatched by lazy { descriptor.spec().id.value.matches(regexPattern) } // *.SomeTest
val isFullPathMatched by lazy { path.matches(regexPattern) } // io.*.SomeTest
val isFullPathDotMatched by lazy { "$path.".matches(regexPattern) } // io.*. or io.*.SomeTest.*
Expand Down

0 comments on commit b9cc276

Please sign in to comment.