public void testSmokeWithCompilerOutput() throws IOException { File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest"); try { File out = new File(tempDir, "out"); File stdlib = ForTestCompileRuntime.runtimeJarForTests(); File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests(); ExitCode exitCode = new K2JVMCompiler() .exec( System.out, "-src", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kt", "-output", out.getAbsolutePath(), "-noStdlib", "-classpath", stdlib.getAbsolutePath(), "-noJdkAnnotations", "-annotations", jdkAnnotations.getAbsolutePath()); Assert.assertEquals(ExitCode.OK, exitCode); assertEquals(1, out.listFiles().length); assertEquals(1, out.listFiles()[0].listFiles().length); } finally { FileUtil.delete(tempDir); } }
public void testSmokeWithCompilerJar() throws IOException { File tempDir = FileUtil.createTempDirectory("compilerTest", "compilerTest"); try { File stdlib = ForTestCompileRuntime.runtimeJarForTests(); File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests(); File resultJar = new File(tempDir, "result.jar"); ExitCode rv = new K2JVMCompiler() .exec( System.out, "-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts", "-jar", resultJar.getAbsolutePath(), "-noStdlib", "-classpath", stdlib.getAbsolutePath(), "-noJdkAnnotations", "-annotations", jdkAnnotations.getAbsolutePath()); Assert.assertEquals("compilation completed with non-zero code", ExitCode.OK, rv); FileInputStream fileInputStream = new FileInputStream(resultJar); try { JarInputStream is = new JarInputStream(fileInputStream); try { final List<String> entries = listEntries(is); assertTrue( entries.contains( "Smoke/" + PackageClassUtils.getPackageClassName(new FqName("Smoke")) + ".class")); assertEquals(1, entries.size()); } finally { is.close(); } } finally { fileInputStream.close(); } } finally { FileUtil.delete(tempDir); } }