diff --git a/test/org/jetbrains/eval4j/jdi/test/jdiTest.kt b/test/org/jetbrains/eval4j/jdi/test/jdiTest.kt index 46e746f0e5a..8af1e2d81c7 100644 --- a/test/org/jetbrains/eval4j/jdi/test/jdiTest.kt +++ b/test/org/jetbrains/eval4j/jdi/test/jdiTest.kt @@ -1,18 +1,18 @@ package org.jetbrains.eval4j.jdi.test +import org.jetbrains.eval4j.* import com.sun.jdi import junit.framework.TestSuite import org.jetbrains.eval4j.test.buildTestSuite import junit.framework.TestCase import org.jetbrains.eval4j.interpreterLoop import org.junit.Assert.* -import org.jetbrains.eval4j.jdi.makeInitialFrame -import org.jetbrains.eval4j.jdi.JDIEval import java.util.concurrent.CountDownLatch import java.util.concurrent.atomic.AtomicInteger import org.jetbrains.eval4j.ExceptionThrown -import org.jetbrains.eval4j.jdi.asJdiValue import org.jetbrains.eval4j.MethodDescription +import org.jetbrains.eval4j.ValueReturned +import org.jetbrains.eval4j.jdi.* val DEBUGEE_CLASS = javaClass() @@ -95,20 +95,31 @@ fun suite(): TestSuite { if (remainingTests.decrementAndGet() == 0) vm.resume() + fun jdi.ObjectReference?.callToString(): String? { + if (this == null) return "null" + return (eval.invokeMethod( + this.asValue(), + MethodDescription( + "java/lang/Object", + "toString", + "()Ljava/lang/String;", + false + ), + listOf()).jdiObj as jdi.StringReference).value() + + } + if (value is ExceptionThrown) { - val str = eval.invokeMethod( - value.exception, - MethodDescription( - "java/lang/Object", - "toString", - "()Ljava/lang/String;", - false - ), - listOf()) + val str = value.exception.jdiObj.callToString() System.err.println("Exception: $str") } - assertEquals(expected, value) + if (expected is ValueReturned && value is ValueReturned && value.result is ObjectValue) { + assertEquals(expected.result.obj.toString(), value.result.jdiObj.callToString()) + } + else { + assertEquals(expected, value) + } } } } diff --git a/test/org/jetbrains/eval4j/test/TestData.java b/test/org/jetbrains/eval4j/test/TestData.java index 95878595309..1b2cf2310d3 100644 --- a/test/org/jetbrains/eval4j/test/TestData.java +++ b/test/org/jetbrains/eval4j/test/TestData.java @@ -153,7 +153,7 @@ class TestData { } static Object getStaticField() { - return String.CASE_INSENSITIVE_ORDER; + return C.FOO; } static int FIELD = 0; @@ -167,6 +167,8 @@ class TestData { } static class C { + static String FOO = "FOO"; + int y = 15; C(int y) {