Apply project code style settings to sequence debugger code

This commit is contained in:
Vitaliy.Bibaev
2018-06-09 11:12:48 +03:00
committed by Yan Zhulanow
parent 245a358ea8
commit 2d22267cf1
67 changed files with 1480 additions and 1413 deletions
@@ -29,85 +29,93 @@ import java.util.*
* @author Vitaliy.Bibaev
*/
abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) : StreamChainBuilderTestCase() {
override fun getTestDataPath(): String =
Paths.get(File("").absolutePath, "idea/testData/debugger/sequence/psi/$relativeTestPath/").toString()
override fun getFileExtension(): String = ".kt"
abstract val kotlinChainBuilder: StreamChainBuilder
override fun getChainBuilder(): StreamChainBuilder = kotlinChainBuilder
private val stdLibName = "kotlin-stdlib"
override fun getTestDataPath(): String =
Paths.get(File("").absolutePath, "idea/testData/debugger/sequence/psi/$relativeTestPath/").toString()
protected abstract fun doTest()
override fun getFileExtension(): String = ".kt"
abstract val kotlinChainBuilder: StreamChainBuilder
override fun getChainBuilder(): StreamChainBuilder = kotlinChainBuilder
private val stdLibName = "kotlin-stdlib"
override fun tearDown() {
doKotlinTearDown(LightPlatformTestCase.getProject(), { super.tearDown() })
}
protected abstract fun doTest()
override final fun getRelativeTestPath(): String = relativePath
override fun setUp() {
super.setUp()
ApplicationManager.getApplication().runWriteAction {
if (ProjectLibraryTable.getInstance(LightPlatformTestCase.getProject()).getLibraryByName(stdLibName) == null) {
val stdLibPath = ForTestCompileRuntime.runtimeJarForTests()
PsiTestUtil.addLibrary(testRootDisposable, LightPlatformTestCase.getModule(), stdLibName, stdLibPath.parent, stdLibPath.name)
}
}
LibraryModificationTracker.getInstance(LightPlatformTestCase.getProject()).incModificationCount()
}
override fun getProjectJDK(): Sdk {
return PluginTestCaseBase.mockJdk9()
}
private fun doKotlinTearDown(project: Project, runnable: () -> Unit) {
unInvalidateBuiltinsAndStdLib(project) {
runnable()
}
}
private fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
val stdLibViewProviders = HashSet<KotlinDecompiledFileViewProvider>()
val vFileToViewProviderMap = ((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap
for ((file, viewProvider) in vFileToViewProviderMap) {
if (file.isStdLibFile && viewProvider is KotlinDecompiledFileViewProvider) {
stdLibViewProviders.add(viewProvider)
}
override fun tearDown() {
doKotlinTearDown(LightPlatformTestCase.getProject(), { super.tearDown() })
}
runnable()
override final fun getRelativeTestPath(): String = relativePath
// Base tearDown() invalidates builtins and std-lib files. Restore them with brute force.
fun unInvalidateFile(file: PsiFileImpl) {
val field = PsiFileImpl::class.java.getDeclaredField("myInvalidated")!!
field.isAccessible = true
field.set(file, false)
override fun setUp() {
super.setUp()
ApplicationManager.getApplication().runWriteAction {
if (ProjectLibraryTable.getInstance(LightPlatformTestCase.getProject()).getLibraryByName(stdLibName) == null) {
val stdLibPath = ForTestCompileRuntime.runtimeJarForTests()
PsiTestUtil.addLibrary(
testRootDisposable,
LightPlatformTestCase.getModule(),
stdLibName,
stdLibPath.parent,
stdLibPath.name
)
}
}
LibraryModificationTracker.getInstance(LightPlatformTestCase.getProject()).incModificationCount()
}
stdLibViewProviders.forEach {
it.allFiles.forEach { unInvalidateFile(it as KtDecompiledFile) }
vFileToViewProviderMap[it.virtualFile] = it
}
}
private val VirtualFile.isStdLibFile: Boolean get() = presentableUrl.contains("kotlin-runtime.jar")
abstract class Positive(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
override fun doTest() {
val chains = buildChains()
checkChains(chains)
override fun getProjectJDK(): Sdk {
return PluginTestCaseBase.mockJdk9()
}
protected fun checkChains(chains: MutableList<StreamChain>) {
TestCase.assertFalse(chains.isEmpty())
private fun doKotlinTearDown(project: Project, runnable: () -> Unit) {
unInvalidateBuiltinsAndStdLib(project) {
runnable()
}
}
}
abstract class Negative(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
override fun doTest() {
val elementAtCaret = configureAndGetElementAtCaret()
TestCase.assertFalse(chainBuilder.isChainExists(elementAtCaret))
TestCase.assertTrue(chainBuilder.build(elementAtCaret).isEmpty())
private fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
val stdLibViewProviders = HashSet<KotlinDecompiledFileViewProvider>()
val vFileToViewProviderMap =
((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap
for ((file, viewProvider) in vFileToViewProviderMap) {
if (file.isStdLibFile && viewProvider is KotlinDecompiledFileViewProvider) {
stdLibViewProviders.add(viewProvider)
}
}
runnable()
// Base tearDown() invalidates builtins and std-lib files. Restore them with brute force.
fun unInvalidateFile(file: PsiFileImpl) {
val field = PsiFileImpl::class.java.getDeclaredField("myInvalidated")!!
field.isAccessible = true
field.set(file, false)
}
stdLibViewProviders.forEach {
it.allFiles.forEach { unInvalidateFile(it as KtDecompiledFile) }
vFileToViewProviderMap[it.virtualFile] = it
}
}
private val VirtualFile.isStdLibFile: Boolean get() = presentableUrl.contains("kotlin-runtime.jar")
abstract class Positive(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
override fun doTest() {
val chains = buildChains()
checkChains(chains)
}
protected fun checkChains(chains: MutableList<StreamChain>) {
TestCase.assertFalse(chains.isEmpty())
}
}
abstract class Negative(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
override fun doTest() {
val elementAtCaret = configureAndGetElementAtCaret()
TestCase.assertFalse(chainBuilder.isChainExists(elementAtCaret))
TestCase.assertTrue(chainBuilder.build(elementAtCaret).isEmpty())
}
}
}
}
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollect
/**
* @author Vitaliy.Bibaev
*/
@Suppress("unused")
abstract class AbstractCollectionTraceTestCase : KotlinTraceTestCase() {
override val librarySupportProvider: LibrarySupportProvider = KotlinCollectionSupportProvider()
}
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibraryS
/**
* @author Vitaliy.Bibaev
*/
abstract class AbstractJavaStreamTraceTestCase: KotlinTraceTestCase() {
@Suppress("unused")
abstract class AbstractJavaStreamTraceTestCase : KotlinTraceTestCase() {
override val librarySupportProvider: LibrarySupportProvider = JavaStandardLibrarySupportProvider()
}
@@ -15,7 +15,9 @@ import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
/**
* This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY
*/
@SuppressWarnings("all")
@TestMetadata("idea/testData/debugger/tinyApp/src/streams/sequence")
@TestDataPath("$PROJECT_ROOT")
@@ -26,7 +28,8 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInSequence() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "terminal");
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "terminal");
}
@TestMetadata("idea/testData/debugger/tinyApp/src/streams/sequence/append")
@@ -38,7 +41,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInAppend() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/append"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/append"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("PlusArray.kt")
@@ -71,7 +76,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInDistinct() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/distinct"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/distinct"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Distinct.kt")
@@ -119,7 +126,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInFilter() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/filter"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/filter"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Drop.kt")
@@ -182,7 +191,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInFlatMap() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/flatMap"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(),
new File("idea/testData/debugger/tinyApp/src/streams/sequence/flatMap"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("FlatMap.kt")
@@ -205,7 +216,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInMap() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/map"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils
.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/map"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Map.kt")
@@ -238,7 +251,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInMisc() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/misc"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils
.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/misc"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("AsSequence.kt")
@@ -326,7 +341,9 @@ public class SequenceTraceTestCaseGenerated extends AbstractSequenceTraceTestCas
}
public void testAllFilesPresentInSort() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/sort"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
KotlinTestUtils
.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/streams/sequence/sort"),
Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("Sorted.kt")
@@ -1,42 +1,44 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
/**
* @author Vitaliy.Bibaev
*/
abstract class TypedChainTestCase(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) {
protected fun doTest(producerAfterType: GenericType,
vararg intermediateAfterTypes: GenericType) {
val elementAtCaret = configureAndGetElementAtCaret()
assertNotNull(elementAtCaret)
val chains = chainBuilder.build(elementAtCaret)
assertFalse(chains.isEmpty())
val chain = chains[0]
val intermediateCalls = chain.intermediateCalls
assertEquals(intermediateAfterTypes.size, intermediateCalls.size)
assertEquals(producerAfterType, chain.qualifierExpression.typeAfter)
protected fun doTest(
producerAfterType: GenericType,
vararg intermediateAfterTypes: GenericType
) {
val elementAtCaret = configureAndGetElementAtCaret()
assertNotNull(elementAtCaret)
val chains = chainBuilder.build(elementAtCaret)
assertFalse(chains.isEmpty())
val chain = chains[0]
val intermediateCalls = chain.intermediateCalls
assertEquals(intermediateAfterTypes.size, intermediateCalls.size)
assertEquals(producerAfterType, chain.qualifierExpression.typeAfter)
if (intermediateAfterTypes.isNotEmpty()) {
assertEquals(producerAfterType, intermediateCalls[0].typeBefore)
for (i in 0 until intermediateAfterTypes.size - 1) {
assertEquals(intermediateAfterTypes[i], intermediateCalls[i].typeAfter)
assertEquals(intermediateAfterTypes[i], intermediateCalls[i + 1].typeBefore)
}
if (intermediateAfterTypes.isNotEmpty()) {
assertEquals(producerAfterType, intermediateCalls[0].typeBefore)
for (i in 0 until intermediateAfterTypes.size - 1) {
assertEquals(intermediateAfterTypes[i], intermediateCalls[i].typeAfter)
assertEquals(intermediateAfterTypes[i], intermediateCalls[i + 1].typeBefore)
}
val lastAfterType = intermediateAfterTypes[intermediateAfterTypes.size - 1]
assertEquals(lastAfterType, chain.terminationCall.typeBefore)
val lastCall = intermediateCalls[intermediateCalls.size - 1]
assertEquals(lastAfterType, lastCall.typeAfter)
} else {
assertEquals(producerAfterType, chain.terminationCall.typeBefore)
val lastAfterType = intermediateAfterTypes[intermediateAfterTypes.size - 1]
assertEquals(lastAfterType, chain.terminationCall.typeBefore)
val lastCall = intermediateCalls[intermediateCalls.size - 1]
assertEquals(lastAfterType, lastCall.typeAfter)
} else {
assertEquals(producerAfterType, chain.terminationCall.typeBefore)
}
}
}
override fun doTest() {
fail("Use doTest(producerAfterType, vararg intermediateAfterTypes)")
}
override fun doTest() {
fail("Use doTest(producerAfterType, vararg intermediateAfterTypes)")
}
}
@@ -1,18 +1,18 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/**
* @author Vitaliy.Bibaev
*/
class PositiveCollectionBuildTest : KotlinPsiChainBuilderTestCase.Positive("collection/positive") {
override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder
override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder
fun testIntermediateIsLastCall() = doTest()
fun testOnlyFilterCall() = doTest()
fun testTerminationCallUsed() = doTest()
fun testOnlyTerminationCallUsed() = doTest()
fun testIntermediateIsLastCall() = doTest()
fun testOnlyFilterCall() = doTest()
fun testTerminationCallUsed() = doTest()
fun testOnlyTerminationCallUsed() = doTest()
}
@@ -1,53 +1,53 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/**
* @author Vitaliy.Bibaev
*/
class TypedCollectionChainTest : TypedChainTestCase("collection/positive/types") {
override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder
override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder
fun testAny() = doTest(KotlinTypes.ANY)
fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY)
fun testAny() = doTest(KotlinTypes.ANY)
fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY)
fun testBoolean() = doTest(KotlinTypes.BOOLEAN)
fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY)
fun testBoolean() = doTest(KotlinTypes.BOOLEAN)
fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY)
fun testByte() = doTest(KotlinTypes.BYTE)
fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY)
fun testByte() = doTest(KotlinTypes.BYTE)
fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY)
fun testShort() = doTest(KotlinTypes.SHORT)
fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY)
fun testShort() = doTest(KotlinTypes.SHORT)
fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY)
fun testInt() = doTest(KotlinTypes.INT)
fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY)
fun testInt() = doTest(KotlinTypes.INT)
fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY)
fun testLong() = doTest(KotlinTypes.LONG)
fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY)
fun testLong() = doTest(KotlinTypes.LONG)
fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY)
fun testFloat() = doTest(KotlinTypes.FLOAT)
fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY)
fun testFloat() = doTest(KotlinTypes.FLOAT)
fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY)
fun testDouble() = doTest(KotlinTypes.DOUBLE)
fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY)
fun testDouble() = doTest(KotlinTypes.DOUBLE)
fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY)
fun testChar() = doTest(KotlinTypes.CHAR)
fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY)
fun testChar() = doTest(KotlinTypes.CHAR)
fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY)
fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN)
fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY)
fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN)
fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY)
fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.INT)
fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY)
fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.INT)
fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY)
fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY)
fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY)
fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY)
fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY)
}
@@ -5,29 +5,29 @@ package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
* @author Vitaliy.Bibaev
*/
class AmbiguousChainsTest : PositiveJavaStreamTest("ambiguous") {
fun testSimpleExpression() = doTest(2)
fun testSimpleExpression() = doTest(2)
fun testNestedExpression() = doTest(3)
fun testSimpleFunctionParameter() = doTest(2)
fun testNestedFunctionParameters() = doTest(3)
fun testNestedFunctionParametersReversed() = doTest(3)
fun testNestedExpression() = doTest(3)
fun testSimpleFunctionParameter() = doTest(2)
fun testNestedFunctionParameters() = doTest(3)
fun testNestedFunctionParametersReversed() = doTest(3)
fun testStreamProducerParameter() = doTest(2)
fun testStreamIntermediateCallParameter() = doTest(2)
fun testStreamTerminatorParameter() = doTest(2)
fun testStreamAllPositions() = doTest(4)
fun testStreamProducerParameter() = doTest(2)
fun testStreamIntermediateCallParameter() = doTest(2)
fun testStreamTerminatorParameter() = doTest(2)
fun testStreamAllPositions() = doTest(4)
fun testNestedStreamProducerParameter() = doTest(3)
fun testNestedStreamIntermediateCallParameter() = doTest(3)
fun testNestedStreamTerminatorCallParameter() = doTest(3)
fun testNestedStreamProducerParameter() = doTest(3)
fun testNestedStreamIntermediateCallParameter() = doTest(3)
fun testNestedStreamTerminatorCallParameter() = doTest(3)
fun testNestedCallInLambda() = doTest(2)
fun testNestedCallInAnonymous() = doTest(2)
fun testNestedCallInLambda() = doTest(2)
fun testNestedCallInAnonymous() = doTest(2)
fun testLinkedChain() = doTest(3)
fun testLinkedChain() = doTest(3)
private fun doTest(chainsCount: Int) {
val chains = buildChains()
assertEquals(chainsCount, chains.size)
}
private fun doTest(chainsCount: Int) {
val chains = buildChains()
assertEquals(chainsCount, chains.size)
}
}
@@ -5,37 +5,37 @@ package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
* @author Vitaliy.Bibaev
*/
class LocationPositiveChainTest : PositiveJavaStreamTest("location") {
fun testAnonymousBody() = doTest()
fun testAnonymousBody() = doTest()
fun testAssignExpression() = doTest()
fun testAssignExpression() = doTest()
fun testFirstParameterOfFunction() = doTest()
fun testLambdaBody() = doTest()
fun testFirstParameterOfFunction() = doTest()
fun testLambdaBody() = doTest()
fun testParameterInAssignExpression() = doTest()
fun testParameterInReturnExpression() = doTest()
fun testParameterInAssignExpression() = doTest()
fun testParameterInReturnExpression() = doTest()
fun testReturnExpression() = doTest()
fun testReturnExpression() = doTest()
fun testSecondParameterOfFunction() = doTest()
fun testSecondParameterOfFunction() = doTest()
fun testSingleExpression() = doTest()
fun testSingleExpression() = doTest()
fun testBeforeStatement() = doTest()
fun testBeforeStatement() = doTest()
fun testBetweenChainCallsBeforeDot() = doTest()
fun testBetweenChainCallsAfterDot() = doTest()
fun testBetweenChainCallsBeforeDot() = doTest()
fun testBetweenChainCallsAfterDot() = doTest()
fun testInEmptyParameterList() = doTest()
fun testInEmptyParameterList() = doTest()
fun testBetweenParametersBeforeComma() = doTest()
fun testBetweenParametersAfterComma() = doTest()
fun testBetweenParametersBeforeComma() = doTest()
fun testBetweenParametersAfterComma() = doTest()
fun testInAnyLambda() = doTest()
fun testInAnyAnonymous() = doTest()
fun testInString() = doTest()
fun testInVariableName() = doTest()
fun testInMethodReference() = doTest()
fun testInAnyLambda() = doTest()
fun testInAnyAnonymous() = doTest()
fun testInString() = doTest()
fun testInVariableName() = doTest()
fun testInMethodReference() = doTest()
fun testAsMethodExpression() = doTest()
fun testAsMethodExpression() = doTest()
}
@@ -1,35 +1,35 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/**
* @author Vitaliy.Bibaev
*/
class NegativeJavaStreamTest : KotlinPsiChainBuilderTestCase.Negative("streams/negative") {
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
fun testFakeStream() = doTest()
fun testFakeStream() = doTest()
fun testWithoutTerminalOperation() = doTest()
fun testWithoutTerminalOperation() = doTest()
fun testNoBreakpoint() = doTest()
fun testNoBreakpoint() = doTest()
fun testBreakpointOnMethod() = doTest()
fun testBreakpointOnIfCondition() = doTest()
fun testBreakpointOnNewScope() = doTest()
fun testBreakpointOnElseBranch() = doTest()
fun testBreakpointOnMethod() = doTest()
fun testBreakpointOnIfCondition() = doTest()
fun testBreakpointOnNewScope() = doTest()
fun testBreakpointOnElseBranch() = doTest()
fun testInLambda() = doTest()
fun testInLambdaWithBody() = doTest()
fun testInAnonymous() = doTest()
fun testInLambda() = doTest()
fun testInLambdaWithBody() = doTest()
fun testInAnonymous() = doTest()
fun testAfterStatement() = doTest()
fun testAfterStatement() = doTest()
fun testInPreviousStatement() = doTest()
fun testInNextStatement() = doTest()
fun testInPreviousStatement() = doTest()
fun testInNextStatement() = doTest()
fun testIdea173415() = doTest()
fun testIdea173415() = doTest()
}
@@ -1,13 +1,13 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.KotlinPsiChainBuilderTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/**
* @author Vitaliy.Bibaev
*/
abstract class PositiveJavaStreamTest(subDirectory: String) : KotlinPsiChainBuilderTestCase.Positive("streams/positive/$subDirectory") {
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
}
@@ -1,28 +1,28 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.DOUBLE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.INT
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.LONG
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/**
* @author Vitaliy.Bibaev
*/
class TypedJavaChainTest : TypedChainTestCase("streams/positive/types") {
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
fun testOneCall() = doTest(NULLABLE_ANY)
fun testMapToSame() = doTest(NULLABLE_ANY, NULLABLE_ANY)
fun testPrimitiveOneCall() = doTest(INT)
fun testPrimitiveMapToSame() = doTest(LONG, LONG)
fun testOneCall() = doTest(NULLABLE_ANY)
fun testMapToSame() = doTest(NULLABLE_ANY, NULLABLE_ANY)
fun testPrimitiveOneCall() = doTest(INT)
fun testPrimitiveMapToSame() = doTest(LONG, LONG)
fun testMapToPrimitive() = doTest(NULLABLE_ANY, DOUBLE)
fun testMapToObj() = doTest(DOUBLE, NULLABLE_ANY)
fun testMapPrimitiveToPrimitive() = doTest(LONG, INT)
fun testMapToPrimitive() = doTest(NULLABLE_ANY, DOUBLE)
fun testMapToObj() = doTest(DOUBLE, NULLABLE_ANY)
fun testMapPrimitiveToPrimitive() = doTest(LONG, INT)
fun testFewTransitions() = doTest(NULLABLE_ANY, INT, NULLABLE_ANY, LONG, DOUBLE)
fun testFewTransitions() = doTest(NULLABLE_ANY, INT, NULLABLE_ANY, LONG, DOUBLE)
}
@@ -1,54 +1,54 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence.KotlinSequenceSupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
/**
* @author Vitaliy.Bibaev
*/
class TypedSequenceChain : TypedChainTestCase("sequence/positive/types") {
override val kotlinChainBuilder: StreamChainBuilder = KotlinSequenceSupportProvider().chainBuilder
override val kotlinChainBuilder: StreamChainBuilder = KotlinSequenceSupportProvider().chainBuilder
fun testAny() = doTest(KotlinTypes.ANY)
fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY)
fun testAny() = doTest(KotlinTypes.ANY)
fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY)
fun testBoolean() = doTest(KotlinTypes.BOOLEAN)
fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY)
fun testBoolean() = doTest(KotlinTypes.BOOLEAN)
fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY)
fun testByte() = doTest(KotlinTypes.BYTE)
fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY)
fun testByte() = doTest(KotlinTypes.BYTE)
fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY)
fun testShort() = doTest(KotlinTypes.SHORT)
fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY)
fun testShort() = doTest(KotlinTypes.SHORT)
fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY)
fun testInt() = doTest(KotlinTypes.INT)
fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY)
fun testInt() = doTest(KotlinTypes.INT)
fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY)
fun testLong() = doTest(KotlinTypes.LONG)
fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY)
fun testLong() = doTest(KotlinTypes.LONG)
fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY)
fun testFloat() = doTest(KotlinTypes.FLOAT)
fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY)
fun testFloat() = doTest(KotlinTypes.FLOAT)
fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY)
fun testDouble() = doTest(KotlinTypes.DOUBLE)
fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY)
fun testDouble() = doTest(KotlinTypes.DOUBLE)
fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY)
fun testChar() = doTest(KotlinTypes.CHAR)
fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY)
fun testChar() = doTest(KotlinTypes.CHAR)
fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY)
fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN)
fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY)
fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN)
fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY)
fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.INT)
fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY)
fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.INT)
fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY)
fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY)
fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY)
fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY)
fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT)
fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY)
}