KT-434 test and ability to supply full JDK for compiler tests

This commit is contained in:
Alex Tkachman
2011-11-19 07:01:58 +02:00
parent 39ca8eded8
commit abb15a85d6
3 changed files with 29 additions and 0 deletions
@@ -0,0 +1,13 @@
import java.net.*
fun String.decodeURI(encoding : String) : String? =
try {
URLDecoder.decode(this, encoding)
}
catch (e : Throwable) {
null
}
fun box() : String {
return if("hhh".decodeURI("lala") == null) "OK" else "fail"
}
@@ -14,6 +14,7 @@ import com.intellij.testFramework.LightVirtualFile;
import com.intellij.testFramework.TestDataFile;
import com.intellij.testFramework.UsefulTestCase;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.jet.compiler.CompileEnvironment;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.plugin.JetLanguage;
@@ -48,12 +49,22 @@ public abstract class JetLiteFixture extends UsefulTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
createEnvironmentWithMockJdk();
}
protected void createEnvironmentWithMockJdk() {
myEnvironment = new JetCoreEnvironment(getTestRootDisposable());
final File rtJar = new File(JetTestCaseBuilder.getHomeDirectory(), "compiler/testData/mockJDK-1.7/jre/lib/rt.jar");
myEnvironment.addToClasspath(rtJar);
myEnvironment.addToClasspath(new File(JetTestCaseBuilder.getHomeDirectory(), "compiler/testData/mockJDK-1.7/jre/lib/annotations.jar"));
}
protected void createEnvironmentWithFullJdk() {
myEnvironment = new JetCoreEnvironment(getTestRootDisposable());
final File rtJar = CompileEnvironment.findRtJar(true);
myEnvironment.addToClasspath(rtJar);
}
@Override
protected void tearDown() throws Exception {
myFile = null;
@@ -216,4 +216,9 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testKt513() throws Exception {
blackBoxFile("regressions/kt513.jet");
}
public void testKt434() throws Exception {
createEnvironmentWithFullJdk();
blackBoxFile("regressions/kt434.jet");
}
}