Add receiver of kotlin.text.toPattern to standard Kotlin injections
#KT-39231 Fixed
This commit is contained in:
committed by
Dmitry Gridin
parent
787d22c93e
commit
9308525d93
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user