-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't generate a broken test when a constructor has a value class par…
…ameter (#94) An implementation detail of the Kotlin compiler gets in our way. Closes: #93 Co-authored-by: Jesse Wilson <[email protected]>
- Loading branch information
1 parent
adf8e8c
commit c9f361f
Showing
8 changed files
with
134 additions
and
1 deletion.
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
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
37 changes: 37 additions & 0 deletions
37
burst-gradle-plugin/src/test/projects/valueClassConstructor/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,37 @@ | ||
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) | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
burst-gradle-plugin/src/test/projects/valueClassConstructor/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,8 @@ | ||
plugins { | ||
kotlin("jvm") | ||
id("app.cash.burst") | ||
} | ||
|
||
dependencies { | ||
testImplementation(kotlin("test")) | ||
} |
27 changes: 27 additions & 0 deletions
27
...t-gradle-plugin/src/test/projects/valueClassConstructor/lib/src/test/kotlin/CoffeeTest.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,27 @@ | ||
import app.cash.burst.Burst | ||
import app.cash.burst.burstValues | ||
import kotlin.test.Test | ||
|
||
@Burst | ||
class CoffeeTest( | ||
private val espresso: Espresso = burstValues(Decaf, Regular, Double), | ||
) { | ||
@Test | ||
fun test() { | ||
println("running $espresso") | ||
} | ||
} | ||
|
||
@JvmInline | ||
value class Espresso(val ordinal: Int) { | ||
override fun toString() = when (this) { | ||
Decaf -> "Decaf" | ||
Regular -> "Regular" | ||
Double -> "Double" | ||
else -> "$ordinal" | ||
} | ||
} | ||
|
||
val Decaf = Espresso(0) | ||
val Regular = Espresso(1) | ||
val Double = Espresso(2) |
9 changes: 9 additions & 0 deletions
9
burst-gradle-plugin/src/test/projects/valueClassConstructor/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") |
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
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