@Override
 protected KotlinCoreEnvironment createEnvironment() {
   File javaFilesDir = createJavaFilesDir();
   return KotlinCoreEnvironment.createForTests(
       getTestRootDisposable(),
       KotlinTestUtils.compilerConfigurationForTests(
           ConfigurationKind.ALL,
           TestJdkKind.FULL_JDK,
           Arrays.asList(KotlinTestUtils.getAnnotationsJar()),
           Arrays.asList(javaFilesDir)),
       EnvironmentConfigFiles.JVM_CONFIG_FILES);
 }
  @NotNull
  private KotlinCoreEnvironment createEnvironment(@NotNull List<File> extraClassPath) {
    List<File> extras = new ArrayList<File>();
    extras.addAll(extraClassPath);
    extras.add(KotlinTestUtils.getAnnotationsJar());

    CompilerConfiguration configuration =
        KotlinTestUtils.compilerConfigurationForTests(
            ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, extras.toArray(new File[extras.size()]));
    return KotlinCoreEnvironment.createForTests(
        getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
  }
  public void testRawTypes() throws Exception {
    KotlinTestUtils.compileJavaFiles(
        Collections.singletonList(new File(getTestDataDirectory() + "/library/test/A.java")),
        Arrays.asList("-d", tmpdir.getPath()));

    Pair<String, ExitCode> outputLib = compileKotlin("library/test/lib.kt", tmpdir, tmpdir);

    Pair<String, ExitCode> outputMain = compileKotlin("main.kt", tmpdir, tmpdir);

    KotlinTestUtils.assertEqualsToFile(
        new File(getTestDataDirectory(), "output.txt"),
        normalizeOutput(outputLib) + "\n" + normalizeOutput(outputMain));
  }
 public void testAllFilesPresentInExpressionSelection() throws Exception {
   KotlinTestUtils.assertAllTestsPresentByMetadata(
       this.getClass(),
       new File("idea/testData/expressionSelection"),
       Pattern.compile("^([^.]+)\\.kt$"),
       true);
 }
 public void testAllFilesPresentInDuplicateJvmSignature() throws Exception {
   KotlinTestUtils.assertAllTestsPresentByMetadata(
       this.getClass(),
       new File("compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature"),
       Pattern.compile("^(.+)\\.kt$"),
       true);
 }
 @TestMetadata("stream.kt")
 public void testStream() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/stream.kt");
   doTest(fileName);
 }
 @TestMetadata("forEachRemainingNullability.kt")
 public void testForEachRemainingNullability() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/forEachRemainingNullability.kt");
   doTest(fileName);
 }
 @TestMetadata("inheritanceStaticMethodFromInterface.kt")
 public void testInheritanceStaticMethodFromInterface() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "compiler/testData/diagnostics/testsWithJava8/statics/inheritanceStaticMethodFromInterface.kt");
   doTest(fileName);
 }
 @TestMetadata("CurrentPackage.kt")
 public void testCurrentPackage() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/CurrentPackage.kt");
   doTest(fileName);
 }
 @TestMetadata("ClassNameConflictWithDefault.kt")
 public void testClassNameConflictWithDefault() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/allUnderImports/ClassNameConflictWithDefault.kt");
   doTest(fileName);
 }
 public void testAllFilesPresentInOptimizeImports() throws Exception {
   KotlinTestUtils.assertAllTestsPresentByMetadata(
       this.getClass(),
       new File("idea/testData/editor/optimizeImports"),
       Pattern.compile("^([^\\.]+)\\.kt$"),
       true);
 }
 @TestMetadata("StaticMethodFromSuper.kt")
 public void testStaticMethodFromSuper() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/StaticMethodFromSuper.kt");
   doTest(fileName);
 }
 @TestMetadata("SamConstructor.kt")
 public void testSamConstructor() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/SamConstructor.kt");
   doTest(fileName);
 }
 @TestMetadata("RemoveImportsIfGeneralBefore.kt")
 public void testRemoveImportsIfGeneralBefore() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/RemoveImportsIfGeneralBefore.kt");
   doTest(fileName);
 }
 @TestMetadata("NestedClassReferenceOutsideClassBody.kt")
 public void testNestedClassReferenceOutsideClassBody() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/NestedClassReferenceOutsideClassBody.kt");
   doTest(fileName);
 }
 @TestMetadata("ClassMemberImported.kt")
 public void testClassMemberImported() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/ClassMemberImported.kt");
   doTest(fileName);
 }
 @TestMetadata("ComponentFunction.kt")
 public void testComponentFunction() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/ComponentFunction.kt");
   doTest(fileName);
 }
 @TestMetadata("NameCountSetting.kt")
 public void testNameCountSetting() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/allUnderImports/NameCountSetting.kt");
   doTest(fileName);
 }
 @TestMetadata("jk.kt")
 public void testJk() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "compiler/testData/diagnostics/testsWithJava8/duplicateJvmSignature/statics/jk.kt");
   doTest(fileName);
 }
 @TestMetadata("PackagesToUseStarImport.kt")
 public void testPackagesToUseStarImport() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/allUnderImports/PackagesToUseStarImport.kt");
   doTest(fileName);
 }
 public void testAllFilesPresentInTargetedBuiltIns() throws Exception {
   KotlinTestUtils.assertAllTestsPresentByMetadata(
       this.getClass(),
       new File("compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns"),
       Pattern.compile("^(.+)\\.kt$"),
       true);
 }
 @TestMetadata("Simple.kt")
 public void testSimple() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/allUnderImports/Simple.kt");
   doTest(fileName);
 }
 @TestMetadata("mutableMapRemove.kt")
 public void testMutableMapRemove() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/mutableMapRemove.kt");
   doTest(fileName);
 }
 @TestMetadata("AlreadyOptimized.kt")
 public void testAlreadyOptimized() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/AlreadyOptimized.kt");
   doTest(fileName);
 }
 @TestMetadata("javaUnrepeatable.kt")
 public void testJavaUnrepeatable() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "compiler/testData/diagnostics/testsWithJava8/annotations/javaUnrepeatable.kt");
   doTest(fileName);
 }
 @TestMetadata("ArrayAccessExpression.kt")
 public void testArrayAccessExpression() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/ArrayAccessExpression.kt");
   doTest(fileName);
 }
Exemplo n.º 27
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   jetCoreEnvironment =
       KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(
           myTestRootDisposable, ConfigurationKind.JDK_ONLY);
 }
 @TestMetadata("CallableReference.kt")
 public void testCallableReference() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/CallableReference.kt");
   doTest(fileName);
 }
 @TestMetadata("labelledStatement.kt")
 public void testLabelledStatement() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/expressionSelection/labelledStatement.kt");
   doTestExpressionSelection(fileName);
 }
 @TestMetadata("ClassFromSameFileImportAddedBug.kt")
 public void testClassFromSameFileImportAddedBug() throws Exception {
   String fileName =
       KotlinTestUtils.navigationMetadata(
           "idea/testData/editor/optimizeImports/ClassFromSameFileImportAddedBug.kt");
   doTest(fileName);
 }