-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripted test for simple test and mixed tests
- Loading branch information
Antonio Lopez Marin
authored and
Antonio Lopez Marin
committed
Jul 9, 2018
1 parent
1b05cc8
commit 0974be8
Showing
11 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kotlinLib("stdlib") | ||
|
||
libraryDependencies ++= Seq( | ||
"com.novocode" % "junit-interface" % "0.11" % Test | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
val ver = System.getProperty("plugin.version") | ||
if (ver == null) | ||
throw new RuntimeException(""" | ||
|The system property 'plugin.version' is not defined. | ||
|Specify this property using scriptedLaunchOpts -Dplugin.version.""" | ||
.stripMargin) | ||
else addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % ver) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package demo | ||
|
||
fun main(args: Array<String>) { | ||
println("Hello, world!") | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
src/sbt-test/kotlin/basic-tests/src/test/kotlin/SimpleTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import org.junit.Test | ||
import junit.framework.TestCase.assertEquals | ||
|
||
class SimpleTest { | ||
|
||
@Test | ||
fun `should works`() { | ||
assertEquals(4, 2 + 2) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> compile | ||
> test | ||
> "test-only *SimpleTest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kotlinLib("stdlib") | ||
|
||
libraryDependencies ++= Seq( | ||
"com.novocode" % "junit-interface" % "0.11" % Test | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
val ver = System.getProperty("plugin.version") | ||
if (ver == null) | ||
throw new RuntimeException(""" | ||
|The system property 'plugin.version' is not defined. | ||
|Specify this property using scriptedLaunchOpts -Dplugin.version.""" | ||
.stripMargin) | ||
else addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % ver) | ||
} |
9 changes: 9 additions & 0 deletions
9
src/sbt-test/kotlin/mixed-tests/src/main/java/demo/JavaCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package demo; | ||
|
||
public class JavaCalculator { | ||
|
||
public int sum(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/kotlin/mixed-tests/src/main/kotlin/Calculator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package demo | ||
|
||
class Calculator(private val calculator: JavaCalculator) { | ||
|
||
fun sum(a: Int, b: Int): Int = calculator.sum(a, b) | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/sbt-test/kotlin/mixed-tests/src/test/kotlin/MixedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import org.junit.Test | ||
import junit.framework.TestCase.assertEquals | ||
import demo.Calculator | ||
import demo.JavaCalculator | ||
|
||
class MixedTest { | ||
|
||
@Test | ||
fun `should sum 2 plus 2`() { | ||
val calculator = Calculator(JavaCalculator()) | ||
assertEquals(4, calculator.sum(2, 2)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> compile | ||
> test | ||
> "test-only *MixedTest" |