Last active
January 29, 2023 21:33
-
-
Save drawers/d3318d22aa804ff68d4a4b831432fe64 to your computer and use it in GitHub Desktop.
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
@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