Delete LoadKotlinCustomTest

It's useless now because enums are loaded the same way from binaries as well as
from sources
This commit is contained in:
Alexander Udalov
2013-11-19 22:52:31 +04:00
parent dd290bbeb9
commit 42839fa061
16 changed files with 60 additions and 264 deletions
@@ -1,73 +0,0 @@
package test
internal final enum class In : jet.Enum<test.In> {
private constructor In()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-In> {
private constructor <class-object-for-In>()
public final /*synthesized*/ fun valueOf(/*0*/ value: jet.String): test.In
public final /*synthesized*/ fun values(): jet.Array<test.In>
}
public enum entry A : test.In {
private constructor A()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-A> : test.In.A {
private constructor <class-object-for-A>()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
}
}
}
private final enum class Pr : jet.Enum<test.Pr> {
private constructor Pr()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-Pr> {
private constructor <class-object-for-Pr>()
public final /*synthesized*/ fun valueOf(/*0*/ value: jet.String): test.Pr
public final /*synthesized*/ fun values(): jet.Array<test.Pr>
}
public enum entry A : test.Pr {
private constructor A()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-A> : test.Pr.A {
private constructor <class-object-for-A>()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
}
}
}
public final enum class Pu : jet.Enum<test.Pu> {
private constructor Pu()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-Pu> {
private constructor <class-object-for-Pu>()
public final /*synthesized*/ fun valueOf(/*0*/ value: jet.String): test.Pu
public final /*synthesized*/ fun values(): jet.Array<test.Pu>
}
public enum entry A : test.Pu {
private constructor A()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-A> : test.Pu.A {
private constructor <class-object-for-A>()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
}
}
}
@@ -1,29 +0,0 @@
package test
internal final class A {
public constructor A()
internal final enum class E : jet.Enum<test.A.E> {
private constructor E()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-E> {
private constructor <class-object-for-E>()
public final /*synthesized*/ fun valueOf(/*0*/ value: jet.String): test.A.E
public final /*synthesized*/ fun values(): jet.Array<test.A.E>
}
public enum entry ENTRY : test.A.E {
private constructor ENTRY()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-ENTRY> : test.A.E.ENTRY {
private constructor <class-object-for-ENTRY>()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
}
}
}
}
@@ -1,33 +0,0 @@
package test
internal final class A {
public constructor A()
internal class object <class-object-for-A> {
private constructor <class-object-for-A>()
}
internal final enum class E : jet.Enum<test.A.E> {
private constructor E()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-E> {
private constructor <class-object-for-E>()
public final /*synthesized*/ fun valueOf(/*0*/ value: jet.String): test.A.E
public final /*synthesized*/ fun values(): jet.Array<test.A.E>
}
public enum entry ENTRY : test.A.E {
private constructor ENTRY()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-ENTRY> : test.A.E.ENTRY {
private constructor <class-object-for-ENTRY>()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
}
}
}
}
@@ -1,25 +0,0 @@
package test
internal final enum class MyEnum : jet.Enum<test.MyEnum> {
private constructor MyEnum()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-MyEnum> {
private constructor <class-object-for-MyEnum>()
public final /*synthesized*/ fun valueOf(/*0*/ value: jet.String): test.MyEnum
public final /*synthesized*/ fun values(): jet.Array<test.MyEnum>
}
public enum entry ENTRY : test.MyEnum {
private constructor ENTRY()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
public class object <class-object-for-ENTRY> : test.MyEnum.ENTRY {
private constructor <class-object-for-ENTRY>()
public final override /*1*/ /*fake_override*/ fun name(): jet.String
public final override /*1*/ /*fake_override*/ fun ordinal(): jet.Int
}
}
}
@@ -31,7 +31,7 @@ import org.jetbrains.jet.jvm.compiler.AbstractLoadCompiledKotlinTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/loadKotlin")
@InnerTestClasses({LoadCompiledKotlinTestGenerated.Annotations.class, LoadCompiledKotlinTestGenerated.Class.class, LoadCompiledKotlinTestGenerated.ClassFun.class, LoadCompiledKotlinTestGenerated.ClassObject.class, LoadCompiledKotlinTestGenerated.Constructor.class, LoadCompiledKotlinTestGenerated.DataClass.class, LoadCompiledKotlinTestGenerated.Fun.class, LoadCompiledKotlinTestGenerated.Inline.class, LoadCompiledKotlinTestGenerated.Prop.class, LoadCompiledKotlinTestGenerated.Type.class, LoadCompiledKotlinTestGenerated.Visibility.class})
@InnerTestClasses({LoadCompiledKotlinTestGenerated.Annotations.class, LoadCompiledKotlinTestGenerated.Class.class, LoadCompiledKotlinTestGenerated.ClassFun.class, LoadCompiledKotlinTestGenerated.ClassObject.class, LoadCompiledKotlinTestGenerated.Constructor.class, LoadCompiledKotlinTestGenerated.DataClass.class, LoadCompiledKotlinTestGenerated.Enum.class, LoadCompiledKotlinTestGenerated.Fun.class, LoadCompiledKotlinTestGenerated.Inline.class, LoadCompiledKotlinTestGenerated.Prop.class, LoadCompiledKotlinTestGenerated.Type.class, LoadCompiledKotlinTestGenerated.Visibility.class})
public class LoadCompiledKotlinTestGenerated extends AbstractLoadCompiledKotlinTest {
public void testAllFilesPresentInLoadKotlin() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/loadKotlin"), Pattern.compile("^(.+)\\.kt$"), true);
@@ -726,6 +726,34 @@ public class LoadCompiledKotlinTestGenerated extends AbstractLoadCompiledKotlinT
}
@TestMetadata("compiler/testData/loadKotlin/enum")
public static class Enum extends AbstractLoadCompiledKotlinTest {
public void testAllFilesPresentInEnum() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/loadKotlin/enum"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("enumVisibility.kt")
public void testEnumVisibility() throws Exception {
doTestWithAccessors("compiler/testData/loadKotlin/enum/enumVisibility.kt");
}
@TestMetadata("innerEnum.kt")
public void testInnerEnum() throws Exception {
doTestWithAccessors("compiler/testData/loadKotlin/enum/innerEnum.kt");
}
@TestMetadata("innerEnumExistingClassObject.kt")
public void testInnerEnumExistingClassObject() throws Exception {
doTestWithAccessors("compiler/testData/loadKotlin/enum/innerEnumExistingClassObject.kt");
}
@TestMetadata("simpleEnum.kt")
public void testSimpleEnum() throws Exception {
doTestWithAccessors("compiler/testData/loadKotlin/enum/simpleEnum.kt");
}
}
@TestMetadata("compiler/testData/loadKotlin/fun")
@InnerTestClasses({Fun.GenericWithTypeVariables.class, Fun.GenericWithoutTypeVariables.class, Fun.NonGeneric.class, Fun.Vararg.class})
public static class Fun extends AbstractLoadCompiledKotlinTest {
@@ -1447,6 +1475,7 @@ public class LoadCompiledKotlinTestGenerated extends AbstractLoadCompiledKotlinT
suite.addTestSuite(ClassObject.class);
suite.addTest(Constructor.innerSuite());
suite.addTestSuite(DataClass.class);
suite.addTestSuite(Enum.class);
suite.addTest(Fun.innerSuite());
suite.addTestSuite(Inline.class);
suite.addTest(Prop.innerSuite());
@@ -57,18 +57,6 @@ public final class LoadDescriptorUtil {
private LoadDescriptorUtil() {
}
@NotNull
public static NamespaceDescriptor compileKotlinAndLoadTestNamespaceDescriptorFromBinary(
@NotNull File kotlinFile,
@NotNull File outDir,
@NotNull Disposable disposable,
@NotNull ConfigurationKind configurationKind
)
throws IOException {
compileKotlinToDirAndGetAnalyzeExhaust(kotlinFile, outDir, disposable, configurationKind);
return loadTestNamespaceAndBindingContextFromJavaRoot(outDir, disposable, ConfigurationKind.JDK_ONLY).first;
}
@NotNull
public static AnalyzeExhaust compileKotlinToDirAndGetAnalyzeExhaust(
@NotNull File kotlinFile,
@@ -1,90 +0,0 @@
/*
* Copyright 2010-2013 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.jvm.compiler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.test.TestCaseWithTmpdir;
import org.jetbrains.jet.test.util.NamespaceComparator;
import java.io.File;
import static org.jetbrains.jet.jvm.compiler.LoadDescriptorUtil.*;
import static org.jetbrains.jet.test.util.NamespaceComparator.*;
/*
* This test should be implemented via AbstractLoadCompiledKotlinTest.
* Atm it's not possible due to enums being loaded differently from binaries (in contrast to from sources).
*/
public final class LoadKotlinCustomTest extends TestCaseWithTmpdir {
@NotNull
private static final String PATH = "compiler/testData/loadKotlinCustom";
@NotNull
private static final String ENUM_DIR = PATH + "/enum";
private void loadDescriptorsFromCompiledAndCompareWithTxt(@NotNull File expectedFile, @NotNull File kotlinFile)
throws Exception {
NamespaceDescriptor namespaceFromClass =
compileKotlinAndLoadTestNamespaceDescriptorFromBinary(kotlinFile, tmpdir, myTestRootDisposable, ConfigurationKind.JDK_ONLY);
validateAndCompareNamespaceWithFile(namespaceFromClass, DONT_INCLUDE_METHODS_OF_OBJECT, expectedFile);
}
private void loadDescriptorsFromSourceAndCompareWithTxt(@NotNull File expectedFile, @NotNull File kotlinFile)
throws Exception {
AnalyzeExhaust exhaust = compileKotlinToDirAndGetAnalyzeExhaust(kotlinFile, tmpdir, getTestRootDisposable(), ConfigurationKind.JDK_ONLY);
NamespaceDescriptor namespaceFromSource = exhaust.getBindingContext().get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR,
TEST_PACKAGE_FQNAME);
assert namespaceFromSource != null;
validateAndCompareNamespaceWithFile(namespaceFromSource, NamespaceComparator.DONT_INCLUDE_METHODS_OF_OBJECT.checkPrimaryConstructors(true),
expectedFile);
}
private void doTest(
@NotNull String expectedSourceDescriptors,
@NotNull String expectedBinaryDescriptors,
@NotNull String kotlinFileName
) throws Exception {
loadDescriptorsFromSourceAndCompareWithTxt(new File(expectedSourceDescriptors), new File(kotlinFileName));
loadDescriptorsFromCompiledAndCompareWithTxt(new File(expectedBinaryDescriptors), new File(kotlinFileName));
}
private void doTest(@NotNull String dir) throws Exception {
String name = getTestName(true);
doTest(dir + "/" + name + "Source.txt",
dir + "/" + name + "Binary.txt",
dir + "/" + name + ".kt");
}
public void testSimpleEnum() throws Exception {
doTest(ENUM_DIR);
}
public void testEnumVisibility() throws Exception {
doTest(ENUM_DIR);
}
public void testInnerEnum() throws Exception {
doTest(ENUM_DIR);
}
public void testInnerEnumExistingClassObject() throws Exception {
doTest(ENUM_DIR);
}
}
@@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparing
@InnerTestClasses({LazyResolveNamespaceComparingTestGenerated.LoadKotlin.class, LazyResolveNamespaceComparingTestGenerated.CompiledJavaCompareWithKotlin.class, LazyResolveNamespaceComparingTestGenerated.NamespaceComparator.class})
public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyResolveNamespaceComparingTest {
@TestMetadata("compiler/testData/loadKotlin")
@InnerTestClasses({LoadKotlin.Annotations.class, LoadKotlin.Class.class, LoadKotlin.ClassFun.class, LoadKotlin.ClassObject.class, LoadKotlin.Constructor.class, LoadKotlin.DataClass.class, LoadKotlin.Fun.class, LoadKotlin.Inline.class, LoadKotlin.Prop.class, LoadKotlin.Type.class, LoadKotlin.Visibility.class})
@InnerTestClasses({LoadKotlin.Annotations.class, LoadKotlin.Class.class, LoadKotlin.ClassFun.class, LoadKotlin.ClassObject.class, LoadKotlin.Constructor.class, LoadKotlin.DataClass.class, LoadKotlin.Enum.class, LoadKotlin.Fun.class, LoadKotlin.Inline.class, LoadKotlin.Prop.class, LoadKotlin.Type.class, LoadKotlin.Visibility.class})
public static class LoadKotlin extends AbstractLazyResolveNamespaceComparingTest {
public void testAllFilesPresentInLoadKotlin() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/loadKotlin"), Pattern.compile("^(.+)\\.kt$"), true);
@@ -728,6 +728,34 @@ public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyReso
}
@TestMetadata("compiler/testData/loadKotlin/enum")
public static class Enum extends AbstractLazyResolveNamespaceComparingTest {
public void testAllFilesPresentInEnum() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/loadKotlin/enum"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("enumVisibility.kt")
public void testEnumVisibility() throws Exception {
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/enum/enumVisibility.kt");
}
@TestMetadata("innerEnum.kt")
public void testInnerEnum() throws Exception {
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/enum/innerEnum.kt");
}
@TestMetadata("innerEnumExistingClassObject.kt")
public void testInnerEnumExistingClassObject() throws Exception {
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/enum/innerEnumExistingClassObject.kt");
}
@TestMetadata("simpleEnum.kt")
public void testSimpleEnum() throws Exception {
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/enum/simpleEnum.kt");
}
}
@TestMetadata("compiler/testData/loadKotlin/fun")
@InnerTestClasses({Fun.GenericWithTypeVariables.class, Fun.GenericWithoutTypeVariables.class, Fun.NonGeneric.class, Fun.Vararg.class})
public static class Fun extends AbstractLazyResolveNamespaceComparingTest {
@@ -1449,6 +1477,7 @@ public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyReso
suite.addTestSuite(ClassObject.class);
suite.addTest(Constructor.innerSuite());
suite.addTestSuite(DataClass.class);
suite.addTestSuite(Enum.class);
suite.addTest(Fun.innerSuite());
suite.addTestSuite(Inline.class);
suite.addTest(Prop.innerSuite());