diff options
Diffstat (limited to 'plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/editor/KotlinBraceMatcherTest.kt')
-rw-r--r-- | plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/editor/KotlinBraceMatcherTest.kt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/editor/KotlinBraceMatcherTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/editor/KotlinBraceMatcherTest.kt new file mode 100644 index 000000000000..f90214fc9f64 --- /dev/null +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/editor/KotlinBraceMatcherTest.kt @@ -0,0 +1,28 @@ +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package org.jetbrains.kotlin.idea.editor + +import com.intellij.codeInsight.highlighting.BraceMatchingUtil +import org.junit.Assert +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase +import org.junit.internal.runners.JUnit38ClassRunner +import org.junit.runner.RunWith + +@RunWith(JUnit38ClassRunner::class) +class KotlinBraceMatcherTest : KotlinLightCodeInsightFixtureTestCase() { + fun testGenericsWithInOutModifiers() { + doBraceMatchingTest("class A<caret><in T, out F, *>") + } + + fun testGenericsWithComplexParameters() { + doBraceMatchingTest("class A<caret><T : List<@Ann(B::class) Int>>") + } + + private fun doBraceMatchingTest(text: String) { + myFixture.configureByText("a.kt", text.trimMargin()) + + val editor = myFixture.editor + val iterator = editor.highlighter.createIterator(editor.caretModel.offset) + val matched = BraceMatchingUtil.matchBrace(editor.document.charsSequence, myFixture.file.fileType, iterator, true) + Assert.assertTrue(matched) + } +}
\ No newline at end of file |