@NotNull protected String loadFileByFullPath(@NotNull String fullPath) { try { File file = new File(fullPath); String content = FileUtil.loadFile(file, Charsets.UTF_8.name(), true); myFiles = CodegenTestFiles.create(file.getName(), content, myEnvironment.getProject()); return content; } catch (IOException e) { throw new RuntimeException(e); } }
public void testNoAssertionsForKotlinFromBinary() throws Exception { CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests( ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK); JetCoreEnvironment tmpEnvironment = new JetCoreEnvironment(getTestRootDisposable(), configuration); GenerationState state = generateCommon( ClassBuilderFactories.TEST, tmpEnvironment, CodegenTestFiles.create( tmpEnvironment.getProject(), new String[] {"notNullAssertions/noAssertionsForKotlin.kt"})); File compiledDirectory = new File(FileUtil.getTempDirectory(), "kotlin-classes"); CompileEnvironmentUtil.writeToOutputDirectory(state.getFactory(), compiledDirectory); setUpEnvironment(true, false, compiledDirectory); loadFile("notNullAssertions/noAssertionsForKotlinMain.kt"); assertNoIntrinsicsMethodIsCalled(PackageClassUtils.getPackageClassName(FqName.ROOT)); }
protected void loadFiles(@NotNull String... names) { myFiles = CodegenTestFiles.create(myEnvironment.getProject(), names); }
protected void loadText(@NotNull String text) { myFiles = CodegenTestFiles.create(DEFAULT_TEST_FILE_NAME + ".kt", text, myEnvironment.getProject()); }