hashCode generation for data classes

This commit is contained in:
Alex Tkachman
2012-09-17 15:52:23 +03:00
parent d825fb25a0
commit 8c823486d7
14 changed files with 264 additions and 37 deletions
@@ -16,7 +16,6 @@
package org.jetbrains.jet.codegen;
import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.test.generator.SimpleTestClassModel;
import org.jetbrains.jet.test.generator.TestGenerator;
@@ -31,7 +30,7 @@ public abstract class AbstractDataClassCodegenTest extends CodegenTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
createEnvironmentWithFullJdk();
}
public static void main(String[] args) throws IOException {
@@ -26,7 +26,7 @@ import java.io.File;
/** This class is generated by {@link org.jetbrains.jet.codegen.AbstractDataClassCodegenTest}. DO NOT MODIFY MANUALLY */
@TestMetadata("compiler/testData/codegen/dataClasses")
@InnerTestClasses({DataClassCodegenTestGenerated.Tostring.class})
@InnerTestClasses({DataClassCodegenTestGenerated.Hashcode.class, DataClassCodegenTestGenerated.Tostring.class})
public class DataClassCodegenTestGenerated extends AbstractDataClassCodegenTest {
public void testAllFilesPresentInDataClasses() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractDataClassCodegenTest", new File("compiler/testData/codegen/dataClasses"), "kt", true);
@@ -82,11 +82,68 @@ public class DataClassCodegenTestGenerated extends AbstractDataClassCodegenTest
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/unitComponent.kt");
}
@TestMetadata("compiler/testData/codegen/dataClasses/hashcode")
public static class Hashcode extends AbstractDataClassCodegenTest {
public void testAllFilesPresentInHashcode() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractDataClassCodegenTest", new File("compiler/testData/codegen/dataClasses/hashcode"), "kt", true);
}
@TestMetadata("array.kt")
public void testArray() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/array.kt");
}
@TestMetadata("boolean.kt")
public void testBoolean() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/boolean.kt");
}
@TestMetadata("byte.kt")
public void testByte() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/byte.kt");
}
@TestMetadata("char.kt")
public void testChar() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/char.kt");
}
@TestMetadata("double.kt")
public void testDouble() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/double.kt");
}
@TestMetadata("float.kt")
public void testFloat() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/float.kt");
}
@TestMetadata("int.kt")
public void testInt() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/int.kt");
}
@TestMetadata("long.kt")
public void testLong() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/long.kt");
}
@TestMetadata("null.kt")
public void testNull() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/null.kt");
}
@TestMetadata("short.kt")
public void testShort() throws Exception {
blackBoxFileByFullPath("compiler/testData/codegen/dataClasses/hashcode/short.kt");
}
}
@TestMetadata("compiler/testData/codegen/dataClasses/tostring")
public static class Tostring extends AbstractDataClassCodegenTest {
public void testAllFilesPresentInTostring() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractDataClassCodegenTest",
new File("compiler/testData/codegen/dataClasses/tostring"), "kt", true);
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.codegen.AbstractDataClassCodegenTest", new File("compiler/testData/codegen/dataClasses/tostring"), "kt", true);
}
@TestMetadata("arrayParams.kt")
@@ -124,6 +181,7 @@ public class DataClassCodegenTestGenerated extends AbstractDataClassCodegenTest
public static Test suite() {
TestSuite suite = new TestSuite("DataClassCodegenTestGenerated");
suite.addTestSuite(DataClassCodegenTestGenerated.class);
suite.addTestSuite(Hashcode.class);
suite.addTestSuite(Tostring.class);
return suite;
}