Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
(cherry picked from commit 38ac066)
  • Loading branch information
jonamireh authored and KSP Auto Pick committed Nov 1, 2024
1 parent 1a84927 commit 6332033
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ abstract class AbstractKSPTest(frontend: FrontendKind<*>) : DisposableTest() {
.map { it.substring(3).trim() }

val results = runTest(testServices, mainModule, libModules, testProcessor)
val expected = expectedResults.joinToString("\n")
val actual = results.joinToString("\n")
println(expected)
println(actual)
Assertions.assertEquals(expectedResults.joinToString("\n"), results.joinToString("\n"))
}
}
10 changes: 5 additions & 5 deletions kotlin-analysis-api/testData/jvmName.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// TEST PROCESSOR: JvmNameProcessor
// EXPECTED:
// (getX, setX), (getY, null)
// (getX, setX), (getY, null)
// (getX, setX), (getY, null), (isOpen, setOpen)
// (getX, setX), (getY, null), (isOpen, setOpen)
// stringParameter
// stringParameter
// stringParameter
Expand All @@ -10,7 +10,7 @@
// END
// MODULE: lib
// FILE: Lib.kt
data class TestLibDataClass(var x: Int, val y: String)
data class TestLibDataClass(var x: Int, val y: String, var isOpen: String)
// FILE: MyAnnotationLib.kt
annotation class MyAnnotationLib(
@get:JvmName("stringParameter")
Expand All @@ -21,13 +21,13 @@ annotation class MyAnnotationLib(
class MyAnnotationUserLib {}

// MODULE: main(lib)
// FILE: K.kt
// FILE: MyAnnotation.kt
annotation class MyAnnotation(
@get:JvmName("stringParameter")
val stringParam: String
)
// FILE: K.kt
data class TestDataClass(var x: Int, val y: String)
data class TestDataClass(var x: Int, val y: String, var isOpen: String)
// FILE: MyAnnotationUser.java
@MyAnnotationLib(stringParameter = "foo")
@MyAnnotation(stringParameter = "foo")
Expand Down
8 changes: 4 additions & 4 deletions test-utils/testData/api/jvmName.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// TEST PROCESSOR: JvmNameProcessor
// EXPECTED:
// (getX, setX), (getY, null)
// (getX, setX), (getY, null)
// (getX, setX), (getY, null), (isOpen, setOpen)
// (isOpen, setOpen), (getX, setX), (getY, null)
// stringParameter
// stringParameter
// stringParameter
Expand All @@ -10,7 +10,7 @@
// END
// MODULE: lib
// FILE: Lib.kt
data class TestLibDataClass(var x: Int, val y: String)
data class TestLibDataClass(var x: Int, val y: String, var isOpen: String)
// FILE: MyAnnotationLib.kt
annotation class MyAnnotationLib(
@get:JvmName("stringParameter")
Expand All @@ -27,7 +27,7 @@ annotation class MyAnnotation(
@get:JvmName("stringParameter")
val stringParam: String
)
data class TestDataClass(var x: Int, val y: String)
data class TestDataClass(var x: Int, val y: String, var isOpen: String)
// FILE: MyAnnotationUser.java
@MyAnnotationLib(stringParameter = "foo")
@MyAnnotation(stringParameter = "foo")
Expand Down

0 comments on commit 6332033

Please sign in to comment.