diff --git a/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/trace/dsl/KotlinDslTest.kt b/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/trace/dsl/KotlinDslTest.kt new file mode 100644 index 000000000000..5cae988b447c --- /dev/null +++ b/plugins/stream-debugger/src/test/java/com/intellij/debugger/streams/trace/dsl/KotlinDslTest.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.debugger.streams.trace.dsl + +import com.intellij.debugger.streams.trace.dsl.impl.DslImpl +import com.intellij.debugger.streams.trace.dsl.impl.kotlin.KotlinStatementFactory + +/** + * @author Vitaliy.Bibaev + */ +class KotlinDslTest : DslTestCase("kotlin", DslImpl(KotlinStatementFactory())) \ No newline at end of file diff --git a/plugins/stream-debugger/testData/dsl/kotlin/arrayCreateFromElements.out b/plugins/stream-debugger/testData/dsl/kotlin/arrayCreateFromElements.out new file mode 100644 index 000000000000..37a11dc14493 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/arrayCreateFromElements.out @@ -0,0 +1 @@ +var array: kotlin.Array = kotlin.arrayOf(10.0, 20.0) diff --git a/plugins/stream-debugger/testData/dsl/kotlin/arrayDeclaration.out b/plugins/stream-debugger/testData/dsl/kotlin/arrayDeclaration.out new file mode 100644 index 000000000000..2f9af4c18500 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/arrayDeclaration.out @@ -0,0 +1 @@ +var a: kotlin.Array diff --git a/plugins/stream-debugger/testData/dsl/kotlin/arrayDefaultDeclaration.out b/plugins/stream-debugger/testData/dsl/kotlin/arrayDefaultDeclaration.out new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/plugins/stream-debugger/testData/dsl/kotlin/arrayElementAssignment.out b/plugins/stream-debugger/testData/dsl/kotlin/arrayElementAssignment.out new file mode 100644 index 000000000000..513895951da1 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/arrayElementAssignment.out @@ -0,0 +1,2 @@ +a[0] = 1 +a[1] = 2 diff --git a/plugins/stream-debugger/testData/dsl/kotlin/arrayElementUsage.out b/plugins/stream-debugger/testData/dsl/kotlin/arrayElementUsage.out new file mode 100644 index 000000000000..6865e4a2daf4 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/arrayElementUsage.out @@ -0,0 +1,2 @@ +a[10] +a[11] diff --git a/plugins/stream-debugger/testData/dsl/kotlin/assignment.out b/plugins/stream-debugger/testData/dsl/kotlin/assignment.out new file mode 100644 index 000000000000..51511d06e4a0 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/assignment.out @@ -0,0 +1,2 @@ +var a: kotlin.Int +a = 100 diff --git a/plugins/stream-debugger/testData/dsl/kotlin/call.out b/plugins/stream-debugger/testData/dsl/kotlin/call.out new file mode 100644 index 000000000000..47792ef604b7 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/call.out @@ -0,0 +1 @@ +this.method() diff --git a/plugins/stream-debugger/testData/dsl/kotlin/callManyArgs.out b/plugins/stream-debugger/testData/dsl/kotlin/callManyArgs.out new file mode 100644 index 000000000000..6fdb0545bf2b --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/callManyArgs.out @@ -0,0 +1 @@ +this.method(10, 20, 30) diff --git a/plugins/stream-debugger/testData/dsl/kotlin/callOneArg.out b/plugins/stream-debugger/testData/dsl/kotlin/callOneArg.out new file mode 100644 index 000000000000..ec06db15c94b --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/callOneArg.out @@ -0,0 +1 @@ +this.method(10) diff --git a/plugins/stream-debugger/testData/dsl/kotlin/declareImmutableVariable.out b/plugins/stream-debugger/testData/dsl/kotlin/declareImmutableVariable.out new file mode 100644 index 000000000000..901fc03d8967 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/declareImmutableVariable.out @@ -0,0 +1 @@ +var a: kotlin.Int diff --git a/plugins/stream-debugger/testData/dsl/kotlin/declareMutableVariable.out b/plugins/stream-debugger/testData/dsl/kotlin/declareMutableVariable.out new file mode 100644 index 000000000000..901fc03d8967 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/declareMutableVariable.out @@ -0,0 +1 @@ +var a: kotlin.Int diff --git a/plugins/stream-debugger/testData/dsl/kotlin/declareVariableAndInit.out b/plugins/stream-debugger/testData/dsl/kotlin/declareVariableAndInit.out new file mode 100644 index 000000000000..1209f24f1041 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/declareVariableAndInit.out @@ -0,0 +1 @@ +var a: kotlin.Int = 10 diff --git a/plugins/stream-debugger/testData/dsl/kotlin/forEach.out b/plugins/stream-debugger/testData/dsl/kotlin/forEach.out new file mode 100644 index 000000000000..3f37db3f487b --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/forEach.out @@ -0,0 +1,4 @@ +var objects: kotlin.collections.List = getObjects() +for (object in objects) { + object.toString() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/forLoop.out b/plugins/stream-debugger/testData/dsl/kotlin/forLoop.out new file mode 100644 index 000000000000..c0f67a7e8be8 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/forLoop.out @@ -0,0 +1,6 @@ +var objects: kotlin.collections.List = getObjects() +var i: kotlin.Int = 0 +while (i < objects.size()) { + i.toString() + i++ +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/if.out b/plugins/stream-debugger/testData/dsl/kotlin/if.out new file mode 100644 index 000000000000..ec9854799d91 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/if.out @@ -0,0 +1,3 @@ +if (true) { + receiver.success() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/ifElse.out b/plugins/stream-debugger/testData/dsl/kotlin/ifElse.out new file mode 100644 index 000000000000..731ac34c8d19 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/ifElse.out @@ -0,0 +1,5 @@ +if (false) { + this.success() +} else { + this.fail() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/ifElseIf.out b/plugins/stream-debugger/testData/dsl/kotlin/ifElseIf.out new file mode 100644 index 000000000000..1663c29e33cb --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/ifElseIf.out @@ -0,0 +1,7 @@ +if (false) { + this.success() +} else { + if (true) { + this.failSuccess() + } +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/ifElseIfElse.out b/plugins/stream-debugger/testData/dsl/kotlin/ifElseIfElse.out new file mode 100644 index 000000000000..b988b4581436 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/ifElseIfElse.out @@ -0,0 +1,9 @@ +if (false) { + this.success() +} else { + if (true) { + this.failSuccess() + } else { + this.failFail() + } +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/lambdaWithCodeBlock.out b/plugins/stream-debugger/testData/dsl/kotlin/lambdaWithCodeBlock.out new file mode 100644 index 000000000000..819fb3593df5 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/lambdaWithCodeBlock.out @@ -0,0 +1,4 @@ +{ y -> + y.method1() + y.method2() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/lambdaWithExpression.out b/plugins/stream-debugger/testData/dsl/kotlin/lambdaWithExpression.out new file mode 100644 index 000000000000..5fb6a5d4456d --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/lambdaWithExpression.out @@ -0,0 +1,3 @@ +{ x -> + x.method() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/linkedMapDeclaration.out b/plugins/stream-debugger/testData/dsl/kotlin/linkedMapDeclaration.out new file mode 100644 index 000000000000..35cce8e6f521 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/linkedMapDeclaration.out @@ -0,0 +1 @@ +var map: kotlin.collections.LinkedHashMap diff --git a/plugins/stream-debugger/testData/dsl/kotlin/linkedMapInitialization.out b/plugins/stream-debugger/testData/dsl/kotlin/linkedMapInitialization.out new file mode 100644 index 000000000000..aa20bbe43824 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/linkedMapInitialization.out @@ -0,0 +1 @@ +var map: kotlin.collections.LinkedHashMap = mutableMapOf() diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapComputeIfAbsent.out b/plugins/stream-debugger/testData/dsl/kotlin/mapComputeIfAbsent.out new file mode 100644 index 000000000000..4122060696fd --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapComputeIfAbsent.out @@ -0,0 +1,3 @@ +map.getOrPut(key, { y -> + map.method() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapContains.out b/plugins/stream-debugger/testData/dsl/kotlin/mapContains.out new file mode 100644 index 000000000000..01bfed93a00e --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapContains.out @@ -0,0 +1 @@ +key in map diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapConvertToArray.out b/plugins/stream-debugger/testData/dsl/kotlin/mapConvertToArray.out new file mode 100644 index 000000000000..5ef9f59b89c8 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapConvertToArray.out @@ -0,0 +1,14 @@ +var resultArray: kotlin.Array +run { + var size: kotlin.Int = map.size + var keys: kotlin.Array = kotlin.arrayOfNulls(size) + var values: kotlin.Array = kotlin.arrayOfNulls(size) + var i: kotlin.Int = 0 + for (key in map.keys) { + keys[i] = key + values[i] = map[key] + i++ + } + resultArray = kotlin.arrayOf(keys, values) +} + diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapDeclaration.out b/plugins/stream-debugger/testData/dsl/kotlin/mapDeclaration.out new file mode 100644 index 000000000000..cdf0c5e6b365 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapDeclaration.out @@ -0,0 +1 @@ +var map: kotlin.collections.HashMap diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapGet.out b/plugins/stream-debugger/testData/dsl/kotlin/mapGet.out new file mode 100644 index 000000000000..88a45824a186 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapGet.out @@ -0,0 +1 @@ +map[key] diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapInitialization.out b/plugins/stream-debugger/testData/dsl/kotlin/mapInitialization.out new file mode 100644 index 000000000000..431248c69503 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapInitialization.out @@ -0,0 +1 @@ +var map: kotlin.collections.HashMap = mutableMapOf() diff --git a/plugins/stream-debugger/testData/dsl/kotlin/mapPut.out b/plugins/stream-debugger/testData/dsl/kotlin/mapPut.out new file mode 100644 index 000000000000..50f186f054a6 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/mapPut.out @@ -0,0 +1 @@ +map[key] = value diff --git a/plugins/stream-debugger/testData/dsl/kotlin/nestedAssignment.out b/plugins/stream-debugger/testData/dsl/kotlin/nestedAssignment.out new file mode 100644 index 000000000000..2bb2f160d54d --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/nestedAssignment.out @@ -0,0 +1,6 @@ +var a: kotlin.Int +if (true) { + a = 100 +} else { + a = 200 +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/nestedScopes.out b/plugins/stream-debugger/testData/dsl/kotlin/nestedScopes.out new file mode 100644 index 000000000000..a084a731f706 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/nestedScopes.out @@ -0,0 +1,6 @@ +run { + this.method() + run { + this.method() + } +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/scope.out b/plugins/stream-debugger/testData/dsl/kotlin/scope.out new file mode 100644 index 000000000000..37cb66541774 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/scope.out @@ -0,0 +1,3 @@ +run { + this.method() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/sizedArrayCreation.out b/plugins/stream-debugger/testData/dsl/kotlin/sizedArrayCreation.out new file mode 100644 index 000000000000..d7b8427c3d09 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/sizedArrayCreation.out @@ -0,0 +1 @@ +arrayOfNulls(100 diff --git a/plugins/stream-debugger/testData/dsl/kotlin/timeVariableDeclaration.out b/plugins/stream-debugger/testData/dsl/kotlin/timeVariableDeclaration.out new file mode 100644 index 000000000000..fcfe344d4291 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/timeVariableDeclaration.out @@ -0,0 +1 @@ +var time: java.util.concurrent.atomic.AtomicInteger = new java.util.concurrent.atomic.AtomicInteger() diff --git a/plugins/stream-debugger/testData/dsl/kotlin/tryBlock.out b/plugins/stream-debugger/testData/dsl/kotlin/tryBlock.out new file mode 100644 index 000000000000..f0863995f4df --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/tryBlock.out @@ -0,0 +1,5 @@ +try { + this.hashCode() +} catch(e : kotlin.Throwable) { + this.fail() +} diff --git a/plugins/stream-debugger/testData/dsl/kotlin/useVariable.out b/plugins/stream-debugger/testData/dsl/kotlin/useVariable.out new file mode 100644 index 000000000000..e0cbec0fdc67 --- /dev/null +++ b/plugins/stream-debugger/testData/dsl/kotlin/useVariable.out @@ -0,0 +1,2 @@ +var a: kotlin.Int = 100 +var b: kotlin.Int = a