Skip to content

Commit 5877609

Browse files
authored
Update to Kotest 6.0.0.M4 + Kotlin 2.1.20 (#37)
1 parent 4115ec0 commit 5877609

File tree

16 files changed

+90
-61
lines changed

16 files changed

+90
-61
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
kotlin("jvm") version "1.8.20" apply false
3-
kotlin("android") version "1.8.20" apply false
2+
kotlin("jvm") version "2.1.20" apply false
3+
kotlin("android") version "2.1.20" apply false
44
id("com.android.application") version "7.4.2" apply false
55
}

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
kotlin.code.style=official
2-
android.useAndroidX=true
2+
android.useAndroidX=true
3+
4+
org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=756m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
5+
systemProp.org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=756m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

kotest-assertions-android/build.gradle.kts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ plugins {
44
kotlin("android")
55
kotlin("kapt")
66
id("com.android.library")
7-
id("org.jetbrains.dokka") version "1.8.10"
7+
id("org.jetbrains.dokka") version "1.9.10"
88
`maven-publish`
99
signing
1010
}
1111

12+
13+
kotlin { jvmToolchain(11) }
14+
1215
android {
16+
namespace = "br.com.colman.kotest.assertions"
1317
compileSdk = 33
1418
defaultConfig {
1519
minSdk = 21
1620
targetSdk = 33
1721

1822
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1923
}
24+
2025
buildTypes {
2126
getByName("release") {
2227
isMinifyEnabled = false
@@ -27,6 +32,7 @@ android {
2732
sourceCompatibility = JavaVersion.VERSION_11
2833
targetCompatibility = JavaVersion.VERSION_11
2934
}
35+
kotlinOptions { jvmTarget = "11"}
3036

3137
packagingOptions {
3238
exclude("META-INF/AL2.0")
@@ -43,7 +49,7 @@ configurations {
4349

4450
dependencies {
4551
implementation("androidx.core:core-ktx:1.10.0")
46-
implementation("io.kotest:kotest-assertions-core:5.9.1")
52+
implementation("io.kotest:kotest-assertions-core:6.0.0.M4")
4753

4854
androidTestImplementation(project(":kotest-runner-android"))
4955
androidTestImplementation("androidx.test:runner:1.5.2")
@@ -116,8 +122,6 @@ publishing {
116122

117123
tasks.named("dokkaHtml").dependsOn("kaptReleaseKotlin")
118124

119-
120-
121125
val signingKey: String? by project
122126
val signingPassword: String? by project
123127

kotest-assertions-android/src/androidTest/kotlin/br/com/colman/kotest/android/matchers/view/ViewMatchersTests.kt

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<manifest package="br.com.colman.kotest.assertions">
1+
<manifest>
22

33
</manifest>

kotest-assertions-android/src/main/kotlin/br/com/colman/kotest/android/matchers/textview/matchers.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ infix fun TextView.shouldNotHaveText(text: String) = this shouldNot haveText(tex
1818
fun haveText(text: String) = object : Matcher<TextView> {
1919
override fun test(value: TextView) = MatcherResult(
2020
text.contentEquals(value.text),
21-
"TextView should have text $text but was ${value.text}",
22-
"TextView should not have text $text, but had"
21+
{ "TextView should have text $text but was ${value.text}" },
22+
{ "TextView should not have text $text, but had" }
2323
)
2424

2525
}
@@ -32,8 +32,8 @@ fun haveTextColorId(@ColorRes colorRes: Int, theme: Theme? = null) = object: Mat
3232

3333
return MatcherResult(
3434
resourceColor == currentColor,
35-
"TextView should have color resource $resourceName(#$resourceColor) but was #$currentColor",
36-
"TextView should not have color $resourceName(#$resourceColor), but had"
35+
{ "TextView should have color resource $resourceName(#$resourceColor) but was #$currentColor" },
36+
{ "TextView should not have color $resourceName(#$resourceColor), but had" }
3737
)
3838
}
3939
}
@@ -55,8 +55,8 @@ fun haveTextColor(@ColorInt color: Int) = object: Matcher<TextView> {
5555

5656
return MatcherResult(
5757
color == currentColor,
58-
"TextView should have color $color but was $currentColor",
59-
"TextView should not have color $color, but had"
58+
{ "TextView should have color $color but was $currentColor" },
59+
{ "TextView should not have color $color, but had" }
6060
)
6161
}
6262
}
@@ -71,7 +71,7 @@ fun TextView.shouldNotBeAllCaps() = this shouldNot beAllCaps()
7171
fun beAllCaps() = object : Matcher<TextView> {
7272
override fun test(value: TextView) = MatcherResult(
7373
value.isAllCaps,
74-
"TextView should have AllCaps as transformation method",
75-
"TextView should not have AllCaps as transformation method"
74+
{ "TextView should have AllCaps as transformation method" },
75+
{ "TextView should not have AllCaps as transformation method" }
7676
)
7777
}

kotest-assertions-android/src/main/kotlin/br/com/colman/kotest/android/matchers/view/matchers.kt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fun View.shouldNotBeVisible() = this shouldNot beVisible()
1212
fun beVisible() = object : Matcher<View> {
1313
override fun test(value: View) = MatcherResult(
1414
value.visibility == View.VISIBLE,
15-
"View should be VISIBLE but was ${value.visibilityAsString()}",
16-
"View should not be VISIBLE, but was"
15+
{ "View should be VISIBLE but was ${value.visibilityAsString()}" },
16+
{ "View should not be VISIBLE, but was" }
1717
)
1818
}
1919

@@ -23,8 +23,8 @@ fun View.shouldNotBeInvisible() = this shouldNot beInvisible()
2323
fun beInvisible() = object : Matcher<View> {
2424
override fun test(value: View) = MatcherResult(
2525
value.visibility == View.INVISIBLE,
26-
"View should be INVISIBLE, but was ${value.visibilityAsString()}",
27-
"View should not be INVISIBLE, but was"
26+
{ "View should be INVISIBLE, but was ${value.visibilityAsString()}" },
27+
{ "View should not be INVISIBLE, but was" }
2828
)
2929
}
3030

@@ -34,8 +34,8 @@ fun View.shouldNotBeGone() = this shouldNot beGone()
3434
fun beGone() = object : Matcher<View> {
3535
override fun test(value: View) = MatcherResult(
3636
value.visibility == View.GONE,
37-
"View should be GONE, but was ${value.visibilityAsString()}",
38-
"View should not be GONE, but was"
37+
{ "View should be GONE, but was ${value.visibilityAsString()}" },
38+
{ "View should not be GONE, but was" }
3939
)
4040

4141
}
@@ -54,8 +54,8 @@ fun View.shouldNotHaveContentDescription() = this shouldNot haveContentDescripti
5454
fun haveContentDescription() = object : Matcher<View> {
5555
override fun test(value: View) = MatcherResult(
5656
value.contentDescription != null && value.contentDescription.isNotBlank(),
57-
"View should have ContentDescription, but had none",
58-
"View should not have ContentDescription, but had ${value.contentDescription}"
57+
{ "View should have ContentDescription, but had none" },
58+
{ "View should not have ContentDescription, but had ${value.contentDescription}" }
5959
)
6060
}
6161

@@ -65,8 +65,8 @@ infix fun View.shouldNotHaveContentDescription(contentDescription: String) = thi
6565
fun haveContentDescription(contentDescription: String) = object : Matcher<View> {
6666
override fun test(value: View) = MatcherResult(
6767
contentDescription.contentEquals(value.contentDescription),
68-
"View should have ContentDescription $contentDescription, but was ${value.contentDescription}",
69-
"View should not have ContentDescription $contentDescription, but had"
68+
{ "View should have ContentDescription $contentDescription, but was ${value.contentDescription}" },
69+
{ "View should not have ContentDescription $contentDescription, but had" }
7070
)
7171
}
7272

@@ -78,8 +78,8 @@ fun View.shouldNotHaveTag(key: Int, value: Any) = this shouldNot haveTag(key, va
7878
fun haveTag(key: Int, tagValue: Any) = object : Matcher<View> {
7979
override fun test(value: View) = MatcherResult(
8080
value.getTag(key) == tagValue,
81-
"View should have tag with Key $key and value $tagValue, but value was $tagValue",
82-
"View should not have tag with Key $key and value $tagValue, but had"
81+
{ "View should have tag with Key $key and value $tagValue, but value was $tagValue" },
82+
{ "View should not have tag with Key $key and value $tagValue, but had" }
8383
)
8484
}
8585

@@ -89,8 +89,8 @@ infix fun View.shouldNotHaveTag(value: Any) = this shouldNot haveTag(value)
8989
fun haveTag(tagValue: Any) = object : Matcher<View> {
9090
override fun test(value: View) = MatcherResult(
9191
value.tag == tagValue,
92-
"View should have tag with value $tagValue, but was ${value.tag}",
93-
"View should not have tag with value $tagValue, but had"
92+
{ "View should have tag with value $tagValue, but was ${value.tag}" },
93+
{ "View should not have tag with value $tagValue, but had" }
9494
)
9595
}
9696

@@ -100,8 +100,8 @@ fun View.shouldNotBeEnabled() = this shouldNot beEnabled()
100100
fun beEnabled() = object : Matcher<View> {
101101
override fun test(value: View) = MatcherResult(
102102
value.isEnabled,
103-
"View should be enabled, but isn't",
104-
"View should not be enabled, but is"
103+
{ "View should be enabled, but isn't" },
104+
{ "View should not be enabled, but is" }
105105
)
106106
}
107107

@@ -111,8 +111,8 @@ fun View.shouldNotBeFocused() = this shouldNot beFocused()
111111
fun beFocused() = object : Matcher<View> {
112112
override fun test(value: View) = MatcherResult(
113113
value.isFocused,
114-
"View should be focused, but isn't",
115-
"View should not be focused, but is"
114+
{ "View should be focused, but isn't" },
115+
{ "View should not be focused, but is" }
116116
)
117117
}
118118

@@ -122,8 +122,8 @@ fun View.shouldNotBeFocusable() = this shouldNot beFocusable()
122122
fun beFocusable() = object : Matcher<View> {
123123
override fun test(value: View) = MatcherResult(
124124
value.isFocusable,
125-
"View should be focusable, but isn't",
126-
"View should not be focusable, but is"
125+
{ "View should be focusable, but isn't" },
126+
{ "View should not be focusable, but is" }
127127
)
128128
}
129129

@@ -133,8 +133,8 @@ fun View.shouldNotBeFocusableInTouchMode() = this shouldNot beFocusableInTouchMo
133133
fun beFocusableInTouchMode() = object : Matcher<View> {
134134
override fun test(value: View) = MatcherResult(
135135
value.isFocusableInTouchMode,
136-
"View should be focusable in touch mode, but isn't",
137-
"View should not be focusable in touch mode, but is"
136+
{ "View should be focusable in touch mode, but isn't" },
137+
{ "View should not be focusable in touch mode, but is" }
138138
)
139139
}
140140

@@ -144,8 +144,8 @@ fun View.shouldNotBeClickable() = this shouldNot beClickable()
144144
fun beClickable() = object : Matcher<View> {
145145
override fun test(value: View) = MatcherResult(
146146
value.isClickable,
147-
"View should be clickable, but isn't",
148-
"View should not be clickable, but is"
147+
{ "View should be clickable, but isn't" },
148+
{ "View should not be clickable, but is" }
149149
)
150150
}
151151

@@ -155,7 +155,7 @@ fun View.shouldNotBeLongClickable() = this shouldNot beLongClickable()
155155
fun beLongClickable() = object : Matcher<View> {
156156
override fun test(value: View) = MatcherResult(
157157
value.isLongClickable,
158-
"View should be long clickable, but isn't",
159-
"View should not be long clickable, but is"
158+
{ "View should be long clickable, but isn't" },
159+
{ "View should not be long clickable, but is" }
160160
)
161161
}

kotest-extensions-android/build.gradle.kts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,35 @@ plugins {
44
kotlin("android")
55
kotlin("kapt")
66
id("com.android.library")
7-
id("org.jetbrains.dokka") version "1.8.10"
7+
id("org.jetbrains.dokka") version "1.9.10"
88
`maven-publish`
99
signing
1010
}
1111

12+
kotlin { jvmToolchain(11) }
13+
1214
android {
15+
namespace = "br.com.colman.kotest.extensions"
1316
compileSdk = 33
1417
defaultConfig {
1518
minSdk = 21
1619
targetSdk = 33
1720

1821
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1922
}
23+
2024
buildTypes {
2125
getByName("release") {
2226
isMinifyEnabled = false
2327
}
2428
}
2529

30+
2631
compileOptions {
2732
sourceCompatibility = JavaVersion.VERSION_11
2833
targetCompatibility = JavaVersion.VERSION_11
2934
}
35+
kotlinOptions { jvmTarget = "11"}
3036

3137
packagingOptions {
3238
exclude("META-INF/AL2.0")
@@ -43,7 +49,7 @@ configurations {
4349

4450
dependencies {
4551
implementation(kotlin("reflect"))
46-
implementation("io.kotest:kotest-framework-api:5.9.1")
52+
implementation("io.kotest:kotest-framework-engine:6.0.0.M4")
4753
implementation("org.robolectric:robolectric:4.12.2")
4854
implementation("junit:junit:4.13.2")
4955
implementation("androidx.appcompat:appcompat:1.7.0")

kotest-extensions-android/kotest-extensions-android-tests/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ plugins {
33
kotlin("android")
44
}
55

6+
kotlin { jvmToolchain(11) }
7+
68
android {
79
namespace = "br.com.colman.kotest"
810
compileSdk = 33
@@ -16,6 +18,11 @@ android {
1618

1719
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1820
}
21+
publishing {
22+
singleVariant("release") {
23+
withSourcesJar()
24+
}
25+
}
1926

2027
packagingOptions {
2128
exclude("META-INF/**")
@@ -27,6 +34,7 @@ android {
2734
sourceCompatibility = JavaVersion.VERSION_11
2835
targetCompatibility = JavaVersion.VERSION_11
2936
}
37+
kotlinOptions { jvmTarget = "11"}
3038

3139
testOptions {
3240
unitTests {

0 commit comments

Comments
 (0)