Add tests for exceptions from evaluate expression

This commit is contained in:
Natalia Ukhorskaya
2014-06-23 17:39:53 +04:00
parent 1687b9cbca
commit a17bcce682
6 changed files with 102 additions and 38 deletions
@@ -9,14 +9,12 @@ LineBreakpoint created at clearCache.kt:86
LineBreakpoint created at clearCache.kt:95
LineBreakpoint created at clearCache.kt:105
LineBreakpoint created at clearCache.kt:113
LineBreakpoint created at clearCache.kt:124
LineBreakpoint created at clearCache.kt:133
LineBreakpoint created at clearCache.kt:143
LineBreakpoint created at clearCache.kt:151
LineBreakpoint created at clearCache.kt:123
LineBreakpoint created at clearCache.kt:131
LineBreakpoint created at clearCache.kt:149
LineBreakpoint created at clearCache.kt:154
LineBreakpoint created at clearCache.kt:161
LineBreakpoint created at clearCache.kt:169
LineBreakpoint created at clearCache.kt:174
LineBreakpoint created at clearCache.kt:181
LineBreakpoint created at clearCache.kt:189
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!RT_JAR! clearCache.ClearCachePackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
clearCache.kt:11
@@ -39,18 +37,15 @@ clearCache.kt:94
clearCache.kt:104
clearCache.kt:112
Compile bytecode for c.size()
clearCache.kt:123
Compile bytecode for c.get(0)
clearCache.kt:132
clearCache.kt:142
clearCache.kt:122
Compile bytecode for o.test()
clearCache.kt:150
clearCache.kt:168
clearCache.kt:130
clearCache.kt:148
Compile bytecode for obj.test()
clearCache.kt:173
clearCache.kt:180
clearCache.kt:153
clearCache.kt:160
Compile bytecode for o.test()
clearCache.kt:188
clearCache.kt:168
Compile bytecode for o.test()
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
@@ -0,0 +1,20 @@
LineBreakpoint created at exceptions.kt:9
LineBreakpoint created at exceptions.kt:14
LineBreakpoint created at exceptions.kt:26
LineBreakpoint created at exceptions.kt:31
LineBreakpoint created at exceptions.kt:42
LineBreakpoint created at exceptions.kt:51
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!RT_JAR! exceptions.ExceptionsPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
exceptions.kt:8
Compile bytecode for fail()
exceptions.kt:13
exceptions.kt:25
Compile bytecode for o as Derived
exceptions.kt:30
exceptions.kt:41
Compile bytecode for c.get(0)
exceptions.kt:50
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -114,26 +114,6 @@ fun subTypePlatform() {
}
}
fun genericRerun() {
if (true) {
val c = ArrayList<Int>()
c.add(1)
// EXPRESSION: c.get(0)
// RESULT: 1: I
//Breakpoint!
val b = 1
}
if (true) {
val c = ArrayList<String>()
c.add("a")
// EXPRESSION: c.get(0)
// RESULT: "a": Ljava/lang/String;
//Breakpoint!
val b = 1
}
}
fun innerClass() {
if (true) {
val o = TestInnerClasses.Base()
@@ -200,7 +180,6 @@ fun main(args: Array<String>) {
primitiveTypes()
subType()
subTypePlatform()
genericRerun()
innerClass()
objects()
}
@@ -0,0 +1,65 @@
package exceptions
import java.util.ArrayList
fun throwException() {
// EXPRESSION: fail()
// RESULT: instance of java.lang.UnsupportedOperationException(id=ID): Ljava/lang/UnsupportedOperationException;
//Breakpoint!
val a = 1
// EXPRESSION: fail()
// RESULT: instance of java.lang.UnsupportedOperationException(id=ID): Ljava/lang/UnsupportedOperationException;
//Breakpoint!
val b = 1
}
fun fail() {
throw UnsupportedOperationException()
}
fun classCast() {
val o = Base()
// EXPRESSION: o as Derived
// RESULT: java.lang.ClassCastException: exceptions.Base cannot be cast to exceptions.Derived: Ljava/lang/ClassCastException;
//Breakpoint!
val a = 1
// EXPRESSION: o as Derived
// RESULT: java.lang.ClassCastException: exceptions.Base cannot be cast to exceptions.Derived: Ljava/lang/ClassCastException;
//Breakpoint!
val b = 1
}
fun genericClassCast() {
if (true) {
val c = ArrayList<Int>()
c.add(1)
// EXPRESSION: c.get(0)
// RESULT: 1: I
//Breakpoint!
val b = 1
}
if (true) {
val c = ArrayList<String>()
c.add("a")
// EXPRESSION: c.get(0)
// RESULT: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number: Ljava/lang/ClassCastException;
//Breakpoint!
val b = 1
}
}
open class Base {
private fun test(): Int = 1
}
class Derived: Base()
fun main(args: Array<String>) {
throwException()
classCast()
genericClassCast()
}