explictly test codegen with jdk-headers

This commit is contained in:
Stepan Koltsov
2012-05-01 23:49:25 +04:00
parent 5e77ca553c
commit d5d05d76f3
3 changed files with 70 additions and 0 deletions
@@ -0,0 +1,13 @@
import java.util.ArrayList
fun box(): String {
val a = ArrayList<Int>()
a.add(74)
a.add(75)
val i: Int = a.get(0)
val j: Int = a.get(1)
if (i != 74) return "fail 1"
if (j != 75) return "fail 2"
if (a.size() != 2) return "epic fail"
return "OK"
}
@@ -0,0 +1,15 @@
import java.util.*
fun box(): String {
val map: Map<String, Int> = HashMap<String, Int>()
map.put("a", 1)
map.put("bb", 2)
map.put("ccc", 3)
map.put("dddd", 4)
if (map.get("a") != 1) return "fail 1"
if (map.size() != 4) return "fail 2"
if (map.get("eeeee") != null) return "fail 3"
if (!map.containsKey("bb")) return "fail 4"
if (map.entrySet().contains("ffffff")) return "fail 5"
return "OK"
}
@@ -0,0 +1,42 @@
/*
* Copyright 2010-2012 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 org.jetbrains.jet.codegen;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
/**
* Test correct code is generated for descriptors loaded as alt jdk headers
*
* @author Stepan Koltsov
*/
public class JdkHeadersTest extends CodegenTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
createEnvironmentWithMockJdk(CompilerSpecialMode.STDLIB);
}
public void testArrayList() {
blackBoxFile("jdk-headers/arrayList.kt");
}
public void testHashMap() {
blackBoxFile("jdk-headers/hashMap.kt");
}
}