Minor: test methods rename
This commit is contained in:
@@ -39,7 +39,7 @@ abstract class AbstractInjectionTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
protected fun testInjectionPresent(text: String, languageId: String? = null, unInjectShouldBePresent: Boolean = true) {
|
||||
protected fun assertInjectionPresent(text: String, languageId: String? = null, unInjectShouldBePresent: Boolean = true) {
|
||||
myFixture.configureByText("${getTestName(true)}.kt", text.trimMargin())
|
||||
|
||||
TestCase.assertFalse("Injection action is available. There's probably no injection at caret place",
|
||||
@@ -56,7 +56,7 @@ abstract class AbstractInjectionTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
protected fun testNoInjection(text: String) {
|
||||
protected fun assertNoInjection(text: String) {
|
||||
myFixture.configureByText("${getTestName(true)}.kt", text.trimMargin())
|
||||
|
||||
TestCase.assertTrue("Injection action is not available. There's probably some injection but nothing was expected.",
|
||||
|
||||
@@ -44,7 +44,7 @@ class KotlinInjectionTest : AbstractInjectionTest() {
|
||||
TestCase.assertNull(myFixture.getReferenceAtCaretPosition())
|
||||
}
|
||||
|
||||
fun testInjectionOnJavaPredefinedMethodWithAnnotation() = testInjectionPresent(
|
||||
fun testInjectionOnJavaPredefinedMethodWithAnnotation() = assertInjectionPresent(
|
||||
"""
|
||||
|val test1 = java.util.regex.Pattern.compile("<caret>pattern")
|
||||
""",
|
||||
@@ -63,7 +63,7 @@ class KotlinInjectionTest : AbstractInjectionTest() {
|
||||
try {
|
||||
Configuration.getInstance().replaceInjections(listOf(customInjection), listOf(), true)
|
||||
|
||||
testInjectionPresent(
|
||||
assertInjectionPresent(
|
||||
"""
|
||||
|val stringBuilder = StringBuilder().replace(0, 0, "<caret><html></html>")
|
||||
""",
|
||||
@@ -76,34 +76,34 @@ class KotlinInjectionTest : AbstractInjectionTest() {
|
||||
}
|
||||
}
|
||||
|
||||
fun testInjectionWithCommentOnProperty() = testInjectionPresent(
|
||||
fun testInjectionWithCommentOnProperty() = assertInjectionPresent(
|
||||
"""
|
||||
|//language=file-reference
|
||||
|val test = "<caret>simple"
|
||||
""")
|
||||
|
||||
fun testInjectionWithUsageOnReceiverWithRuntime() = testInjectionPresent(
|
||||
fun testInjectionWithUsageOnReceiverWithRuntime() = assertInjectionPresent(
|
||||
"""
|
||||
|val test = "<caret>some"
|
||||
|fun foo() = test.toRegex()
|
||||
""",
|
||||
languageId = RegExpLanguage.INSTANCE.id, unInjectShouldBePresent = false)
|
||||
|
||||
fun testInjectionWithUsageInParameterWithRuntime() = testInjectionPresent(
|
||||
fun testInjectionWithUsageInParameterWithRuntime() = assertInjectionPresent(
|
||||
"""
|
||||
|val test = "<caret>some"
|
||||
|fun foo() = Regex(test)
|
||||
""",
|
||||
languageId = RegExpLanguage.INSTANCE.id, unInjectShouldBePresent = false)
|
||||
|
||||
fun testNoInjectionThoughSeveralAssignmentsWithRuntime() = testNoInjection(
|
||||
fun testNoInjectionThoughSeveralAssignmentsWithRuntime() = assertNoInjection(
|
||||
"""
|
||||
|val first = "<caret>some"
|
||||
|val test = first
|
||||
|fun foo() = Regex(test)
|
||||
""")
|
||||
|
||||
fun testInjectionWithMultipleCommentsOnFun() = testInjectionPresent(
|
||||
fun testInjectionWithMultipleCommentsOnFun() = assertInjectionPresent(
|
||||
"""
|
||||
|// Some comment
|
||||
|// Other comment
|
||||
@@ -111,7 +111,7 @@ class KotlinInjectionTest : AbstractInjectionTest() {
|
||||
|fun test() = "<caret>simple"
|
||||
""")
|
||||
|
||||
fun testInjectionWithAnnotationOnPropertyWithAnnotation() = testInjectionPresent(
|
||||
fun testInjectionWithAnnotationOnPropertyWithAnnotation() = assertInjectionPresent(
|
||||
"""
|
||||
|@org.intellij.lang.annotations.Language("file-reference")
|
||||
|val test = "<caret>simple"
|
||||
|
||||
@@ -20,50 +20,50 @@ import org.intellij.lang.regexp.RegExpLanguage
|
||||
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
|
||||
class KotlinStdlibInjectionTest : AbstractInjectionTest() {
|
||||
fun testOnRegex0() = testInjection(
|
||||
fun testOnRegex0() = assertInjectionPresent(
|
||||
"""
|
||||
|val test1 = kotlin.text.Regex("<caret>some")
|
||||
""",
|
||||
RegExpLanguage.INSTANCE.id
|
||||
)
|
||||
|
||||
fun testOnRegex1() = testInjection(
|
||||
fun testOnRegex1() = assertInjectionPresent(
|
||||
"""
|
||||
|val test1 = kotlin.text.Regex("<caret>some", RegexOption.COMMENTS)
|
||||
""",
|
||||
RegExpLanguage.INSTANCE.id
|
||||
)
|
||||
|
||||
fun testOnRegex2() = testInjection(
|
||||
fun testOnRegex2() = assertInjectionPresent(
|
||||
"""
|
||||
|val test1 = kotlin.text.Regex("<caret>some", setOf(RegexOption.COMMENTS))
|
||||
""",
|
||||
RegExpLanguage.INSTANCE.id
|
||||
)
|
||||
|
||||
fun testToRegex0() = testInjection(
|
||||
fun testToRegex0() = assertInjectionPresent(
|
||||
"""
|
||||
|val test = "hi<caret>".toRegex()
|
||||
""",
|
||||
RegExpLanguage.INSTANCE.id
|
||||
)
|
||||
|
||||
fun testToRegex1() = testInjection(
|
||||
fun testToRegex1() = assertInjectionPresent(
|
||||
"""
|
||||
|val test = "hi<caret>".toRegex(RegexOption.CANON_EQ)
|
||||
""",
|
||||
RegExpLanguage.INSTANCE.id
|
||||
)
|
||||
|
||||
fun testToRegex2() = testInjection(
|
||||
fun testToRegex2() = assertInjectionPresent(
|
||||
"""
|
||||
|val test = "hi<caret>".toRegex(setOf(RegexOption.LITERAL))
|
||||
""",
|
||||
RegExpLanguage.INSTANCE.id
|
||||
)
|
||||
|
||||
private fun testInjection(text: String, languageId: String) {
|
||||
testInjectionPresent(text, languageId, false)
|
||||
private fun assertInjectionPresent(text: String, languageId: String) {
|
||||
assertInjectionPresent(text, languageId, false)
|
||||
}
|
||||
|
||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
||||
Reference in New Issue
Block a user