Skip to content

Instantly share code, notes, and snippets.

@drawers
Last active January 29, 2023 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drawers/d3318d22aa804ff68d4a4b831432fe64 to your computer and use it in GitHub Desktop.
Save drawers/d3318d22aa804ff68d4a4b831432fe64 to your computer and use it in GitHub Desktop.
@Test
fun `target is a data class`() {
val kotlinSource = SourceFile.kotlin(
"file1.kt",
"""
package com.tests.summable
import com.tsongkha.kspexample.annotation.IntSummable
@IntSummable
data class FooSummable(
val bar: Int = 234,
val baz: Int = 123
)
"""
)
val compilation = compilation(kotlinSource)
val result = compilation.compile()
assertSourceEquals(
"""
package com.tests.summable
import kotlin.Int
public fun FooSummable.sumInts(): Int {
val sum = bar + baz
return sum
}""",
result.sourceFor("FooSummableExt.kt")
)
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment