-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a failing test for JUnit 5 extensions
I looked into implementing this and it gets ugly quite quickly. I believe the best implementation applies Burst's transformation only to recognized parameters (enums, booleans, burstValues) and preserves existing behavior otherwise. Unfortunately the code to implement this is pretty tricky. I've decided to not implement this behavior for now. If it's requested we can reconsider.
- Loading branch information
1 parent
97c329e
commit 7c63761
Showing
5 changed files
with
105 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
41 changes: 41 additions & 0 deletions
41
burst-gradle-plugin/src/test/projects/junit5Extensions/build.gradle.kts
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,41 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile | ||
|
||
buildscript { | ||
repositories { | ||
maven { | ||
url = file("$rootDir/../../../../../build/testMaven").toURI() | ||
} | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
classpath("app.cash.burst:burst-gradle-plugin:${project.property("burstVersion")}") | ||
classpath(libs.kotlin.gradlePlugin) | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
maven { | ||
url = file("$rootDir/../../../../../build/testMaven").toURI() | ||
} | ||
mavenCentral() | ||
google() | ||
} | ||
|
||
tasks.withType(JavaCompile::class.java).configureEach { | ||
sourceCompatibility = "1.8" | ||
targetCompatibility = "1.8" | ||
} | ||
|
||
tasks.withType(KotlinJvmCompile::class.java).configureEach { | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_1_8) | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
burst-gradle-plugin/src/test/projects/junit5Extensions/lib/build.gradle.kts
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 @@ | ||
plugins { | ||
kotlin("jvm") | ||
id("app.cash.burst") | ||
} | ||
|
||
dependencies { | ||
testImplementation(kotlin("test")) | ||
testImplementation(libs.junit) | ||
} |
16 changes: 16 additions & 0 deletions
16
burst-gradle-plugin/src/test/projects/junit5Extensions/lib/src/test/kotlin/TempDirTest.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,16 @@ | ||
import app.cash.burst.Burst | ||
import app.cash.burst.burstValues | ||
import java.io.File | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.io.TempDir | ||
|
||
@Burst | ||
class TempDirTest { | ||
@Test | ||
fun test( | ||
@TempDir tempDir: File, | ||
string: String = burstValues("a", "b"), | ||
) { | ||
println("running $tempDir $string") | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
burst-gradle-plugin/src/test/projects/junit5Extensions/settings.gradle.kts
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 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../../../../../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
include(":lib") |