Add receiver of kotlin.text.toPattern to standard Kotlin injections

#KT-39231 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-05-30 14:31:53 +09:00
committed by Dmitry Gridin
parent 787d22c93e
commit 9308525d93
2 changed files with 17 additions and 0 deletions
@@ -8,5 +8,8 @@
<place><![CDATA[ <place><![CDATA[
receiver().ofFunction(kotlinFunction().withName("toRegex").withReceiver("kotlin.String").definedInPackage("kotlin.text")) receiver().ofFunction(kotlinFunction().withName("toRegex").withReceiver("kotlin.String").definedInPackage("kotlin.text"))
]]></place> ]]></place>
<place><![CDATA[
receiver().ofFunction(kotlinFunction().withName("toPattern").withReceiver("kotlin.String").definedInPackage("kotlin.text"))
]]></place>
</injection> </injection>
</component> </component>
@@ -55,6 +55,20 @@ class KotlinStdlibInjectionTest : AbstractInjectionTest() {
RegExpLanguage.INSTANCE.id RegExpLanguage.INSTANCE.id
) )
fun testToPattern0() = assertInjectionPresent(
"""
val test = "a.*b<caret>".toPattern()
""",
RegExpLanguage.INSTANCE.id
)
fun testToPattern1() = assertInjectionPresent(
"""
val test = "a.*b<caret>".toPattern(java.util.regex.Pattern.CASE_INSENSITIVE)
""",
RegExpLanguage.INSTANCE.id
)
private fun assertInjectionPresent(@Language("kotlin") text: String, languageId: String) { private fun assertInjectionPresent(@Language("kotlin") text: String, languageId: String) {
doInjectionPresentTest(text, languageId = languageId, unInjectShouldBePresent = false) doInjectionPresentTest(text, languageId = languageId, unInjectShouldBePresent = false)
} }