Add codegen tests for package visibility
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package protectedPack;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
class packageClass {
|
||||
public String test() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return packageClass().test()!!
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package protectedPack;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
public class packageFun {
|
||||
String test() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return packageFun().test()!!
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package protectedPack;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
public class packageProperty {
|
||||
String test = "OK";
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package protectedPack
|
||||
|
||||
fun box(): String {
|
||||
return packageProperty().test!!
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.codegen;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractJavaVisibilityTest extends CodegenTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected GeneratedClassLoader createClassLoader(@NotNull ClassFileFactory factory) {
|
||||
initializedClassLoader = new GeneratedClassLoader(factory, CodegenTestCase.class.getClassLoader(), getClassPathURLs());
|
||||
return initializedClassLoader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.codegen;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import java.io.File;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import org.jetbrains.jet.codegen.AbstractJavaVisibilityTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/visibility")
|
||||
@InnerTestClasses({JavaVisibilityTestGenerated.Package.class})
|
||||
public class JavaVisibilityTestGenerated extends AbstractJavaVisibilityTest {
|
||||
public void testAllFilesPresentInVisibility() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/visibility"), "kt", true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/visibility/package")
|
||||
public static class Package extends AbstractJavaVisibilityTest {
|
||||
public void testAllFilesPresentInPackage() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/visibility/package"), "kt", true);
|
||||
}
|
||||
|
||||
@TestMetadata("packageClass.kt")
|
||||
public void testPackageClass() throws Exception {
|
||||
blackBoxFileWithJavaByFullPath("compiler/testData/codegen/visibility/package/packageClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("packageFun.kt")
|
||||
public void testPackageFun() throws Exception {
|
||||
blackBoxFileWithJavaByFullPath("compiler/testData/codegen/visibility/package/packageFun.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("packageProperty.kt")
|
||||
public void testPackageProperty() throws Exception {
|
||||
blackBoxFileWithJavaByFullPath("compiler/testData/codegen/visibility/package/packageProperty.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("JavaVisibilityTestGenerated");
|
||||
suite.addTestSuite(JavaVisibilityTestGenerated.class);
|
||||
suite.addTestSuite(Package.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve;
|
||||
import org.jetbrains.jet.checkers.AbstractJetPsiCheckerTest;
|
||||
import org.jetbrains.jet.codegen.AbstractCheckLocalVariablesTableTest;
|
||||
import org.jetbrains.jet.codegen.AbstractDataClassCodegenTest;
|
||||
import org.jetbrains.jet.codegen.AbstractJavaVisibilityTest;
|
||||
import org.jetbrains.jet.codegen.defaultConstructor.AbstractDefaultConstructorCodegenTest;
|
||||
import org.jetbrains.jet.codegen.flags.AbstractWriteFlagsTest;
|
||||
import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
||||
@@ -95,6 +96,13 @@ public class GenerateTests {
|
||||
testModel("compiler/testData/codegen/dataClasses", "blackBoxFileByFullPath")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"compiler/tests/",
|
||||
"JavaVisibilityTestGenerated",
|
||||
AbstractJavaVisibilityTest.class,
|
||||
testModel("compiler/testData/codegen/visibility", "blackBoxFileWithJavaByFullPath")
|
||||
);
|
||||
|
||||
generateTest(
|
||||
"compiler/tests/",
|
||||
"CheckLocalVariablesTableTestGenerated",
|
||||
|
||||
Reference in New Issue
Block a user