BuildTools: added tests for ant task Kotlin2JsCompilerTask.

This commit is contained in:
Zalim Bashorov
2013-11-14 16:17:16 +04:00
parent df4850c22f
commit bfa79efaf3
34 changed files with 314 additions and 14 deletions
@@ -0,0 +1 @@
fun bar() {}
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1,[TestData]/bar.kt,[TestData]/root2/Foo.kt] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,14 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" >
<src>
<pathelement path="${test.data}/bar.kt"/>
<fileset dir="${test.data}/root2">
<include name="**/*.kt"/>
</fileset>
</src>
</kotlin2js>
</target>
</project>
@@ -0,0 +1,7 @@
package foo
fun box(): String {
Foo()
bar()
return "OK"
}
@@ -0,0 +1 @@
function Bar () {}
@@ -0,0 +1 @@
class Foo
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js"/>
</target>
</project>
@@ -0,0 +1,3 @@
package foo
fun box(): String = "OK"
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" main="call"/>
</target>
</project>
@@ -0,0 +1,9 @@
package foo
var ok = "FAIL"
fun main(args: Array<String>) {
ok = "OK"
}
fun box(): String = ok
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" outputPostfix="${test.data}/postfix" />
</target>
</project>
@@ -0,0 +1,3 @@
/*
some postfix
*/
@@ -0,0 +1,3 @@
package foo
fun box(): String = "OK"
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" outputPrefix="${test.data}/prefix" />
</target>
</project>
@@ -0,0 +1,3 @@
/*
some prefix
*/
@@ -0,0 +1,3 @@
package foo
fun box(): String = "OK"
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" outputPrefix="${test.data}/prefix" outputPostfix="${test.data}/postfix" />
</target>
</project>
@@ -0,0 +1,3 @@
/*
some postfix
*/
@@ -0,0 +1,3 @@
/*
some prefix
*/
@@ -0,0 +1,3 @@
package foo
fun box(): String = "OK"
@@ -0,0 +1,8 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
OUT [kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
OUT
OUT BUILD SUCCESSFUL
OUT Total time: [time]
Return code: 0
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" sourcemap="true"/>
</target>
</project>
@@ -0,0 +1,3 @@
package foo
fun box(): String = "OK"
@@ -0,0 +1,9 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
ERR
ERR BUILD FAILED
ERR [TestData]/build.xml:5: "output" should be specified
ERR
ERR Total time: [time]
Return code: 1
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js src="${test.data}/root1"/>
</target>
</project>
@@ -0,0 +1,9 @@
OUT Buildfile: [TestData]/build.xml
OUT
OUT build:
ERR
ERR BUILD FAILED
ERR [TestData]/build.xml:5: "src" should be specified
ERR
ERR Total time: [time]
Return code: 1
@@ -0,0 +1,7 @@
<project name="Ant Task Test" default="build">
<taskdef resource="org/jetbrains/jet/buildtools/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
<target name="build">
<kotlin2js output="${temp}/out.js"/>
</target>
</project>