Skip to content

Commit 743c30b

Browse files
add missing test
1 parent 685554c commit 743c30b

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/KoParameterDeclarationForKoTextProviderTest.kt

+26-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import org.junit.jupiter.api.Test
77

88
class KoParameterDeclarationForKoTextProviderTest {
99
@Test
10-
fun `parameter-text`() {
10+
fun `parameter-in-constructor-text`() {
1111
// given
1212
val sut =
13-
getSnippetFile("parameter-text")
13+
getSnippetFile("parameter-in-constructor-text")
1414
.classes()
1515
.first()
1616
.primaryConstructor
@@ -31,5 +31,29 @@ class KoParameterDeclarationForKoTextProviderTest {
3131
}
3232
}
3333

34+
@Test
35+
fun `parameter-in-function-invocation-text`() {
36+
// given
37+
val sut =
38+
getSnippetFile("parameter-in-function-invocation-text")
39+
.functions()
40+
.first()
41+
.parameters
42+
.first()
43+
44+
// then
45+
assertSoftly(sut) {
46+
text shouldBeEqualTo "sampleParameter: Int"
47+
hasTextStartingWith("sampl") shouldBeEqualTo true
48+
hasTextStartingWith("Other") shouldBeEqualTo false
49+
hasTextEndingWith(": Int") shouldBeEqualTo true
50+
hasTextEndingWith("other") shouldBeEqualTo false
51+
hasTextContaining("sampleParameter: ") shouldBeEqualTo true
52+
hasTextContaining("anno") shouldBeEqualTo false
53+
hasTextMatching(Regex("^[^@]*\$")) shouldBeEqualTo true
54+
hasTextMatching(Regex("[0-9]+")) shouldBeEqualTo false
55+
}
56+
}
57+
3458
private fun getSnippetFile(fileName: String) = getSnippetKoScope("core/declaration/koparameter/snippet/forkotextprovider/", fileName)
3559
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fun sampleFunction(sampleParameter: Int) {}

0 commit comments

Comments
 (0)