mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add tests for kotlin dsl support
This commit is contained in:
+24
@@ -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()))
|
||||
@@ -0,0 +1 @@
|
||||
var array: kotlin.Array<kotlin.Double> = kotlin.arrayOf<kotlin.Double>(10.0, 20.0)
|
||||
@@ -0,0 +1 @@
|
||||
var a: kotlin.Array<kotlin.Int>
|
||||
@@ -0,0 +1,2 @@
|
||||
a[0] = 1
|
||||
a[1] = 2
|
||||
@@ -0,0 +1,2 @@
|
||||
a[10]
|
||||
a[11]
|
||||
@@ -0,0 +1,2 @@
|
||||
var a: kotlin.Int
|
||||
a = 100
|
||||
@@ -0,0 +1 @@
|
||||
this.method()
|
||||
@@ -0,0 +1 @@
|
||||
this.method(10, 20, 30)
|
||||
@@ -0,0 +1 @@
|
||||
this.method(10)
|
||||
@@ -0,0 +1 @@
|
||||
var a: kotlin.Int
|
||||
@@ -0,0 +1 @@
|
||||
var a: kotlin.Int
|
||||
@@ -0,0 +1 @@
|
||||
var a: kotlin.Int = 10
|
||||
@@ -0,0 +1,4 @@
|
||||
var objects: kotlin.collections.List<kotlin.Any> = getObjects()
|
||||
for (object in objects) {
|
||||
object.toString()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
var objects: kotlin.collections.List<kotlin.Any> = getObjects()
|
||||
var i: kotlin.Int = 0
|
||||
while (i < objects.size()) {
|
||||
i.toString()
|
||||
i++
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
if (true) {
|
||||
receiver.success()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
if (false) {
|
||||
this.success()
|
||||
} else {
|
||||
this.fail()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
if (false) {
|
||||
this.success()
|
||||
} else {
|
||||
if (true) {
|
||||
this.failSuccess()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
if (false) {
|
||||
this.success()
|
||||
} else {
|
||||
if (true) {
|
||||
this.failSuccess()
|
||||
} else {
|
||||
this.failFail()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{ y ->
|
||||
y.method1()
|
||||
y.method2()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{ x ->
|
||||
x.method()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var map: kotlin.collections.LinkedHashMap<kotlin.Int, kotlin.Boolean>
|
||||
@@ -0,0 +1 @@
|
||||
var map: kotlin.collections.LinkedHashMap<kotlin.Int, kotlin.Boolean> = mutableMapOf()
|
||||
@@ -0,0 +1,3 @@
|
||||
map.getOrPut(key, { y ->
|
||||
map.method()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
key in map
|
||||
@@ -0,0 +1,14 @@
|
||||
var resultArray: kotlin.Array<kotlin.Any>
|
||||
run {
|
||||
var size: kotlin.Int = map.size
|
||||
var keys: kotlin.Array<kotlin.Int> = kotlin.arrayOfNulls<kotlin.Int>(size)
|
||||
var values: kotlin.Array<kotlin.Any> = kotlin.arrayOfNulls<kotlin.Any>(size)
|
||||
var i: kotlin.Int = 0
|
||||
for (key in map.keys) {
|
||||
keys[i] = key
|
||||
values[i] = map[key]
|
||||
i++
|
||||
}
|
||||
resultArray = kotlin.arrayOf<kotlin.Any>(keys, values)
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
var map: kotlin.collections.HashMap<kotlin.Int, kotlin.Boolean>
|
||||
@@ -0,0 +1 @@
|
||||
map[key]
|
||||
@@ -0,0 +1 @@
|
||||
var map: kotlin.collections.HashMap<kotlin.Int, kotlin.Int> = mutableMapOf()
|
||||
@@ -0,0 +1 @@
|
||||
map[key] = value
|
||||
@@ -0,0 +1,6 @@
|
||||
var a: kotlin.Int
|
||||
if (true) {
|
||||
a = 100
|
||||
} else {
|
||||
a = 200
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
run {
|
||||
this.method()
|
||||
run {
|
||||
this.method()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
run {
|
||||
this.method()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
arrayOfNulls<kotlin.String>(100
|
||||
@@ -0,0 +1 @@
|
||||
var time: java.util.concurrent.atomic.AtomicInteger = new java.util.concurrent.atomic.AtomicInteger()
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
this.hashCode()
|
||||
} catch(e : kotlin.Throwable) {
|
||||
this.fail()
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
var a: kotlin.Int = 100
|
||||
var b: kotlin.Int = a
|
||||
Reference in New Issue
Block a user