-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
33 changes: 33 additions & 0 deletions
33
...in-code-generation/src/test/kotlin/spi/processor/KotlinFileSpecEmptyInputProcessorTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.toolisticon.kotlin.generation.spi.processor | ||
|
||
import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi | ||
import io.toolisticon.kotlin.generation.KotlinCodeGeneration | ||
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.fileBuilder | ||
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.className | ||
import io.toolisticon.kotlin.generation._test.MutableSpiRegistry | ||
import io.toolisticon.kotlin.generation._test.TestContext | ||
import io.toolisticon.kotlin.generation.builder.KotlinFileSpecBuilder | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
|
||
@OptIn(ExperimentalKotlinPoetApi::class) | ||
internal class KotlinFileSpecEmptyInputProcessorTest { | ||
|
||
@Test | ||
fun `add doc to file via processor`() { | ||
val file = fileBuilder("foo", "bar") | ||
|
||
class AddDocProcessor : KotlinFileSpecEmptyInputProcessor<TestContext>(TestContext::class) { | ||
override fun invoke(context: TestContext, builder: KotlinFileSpecBuilder): KotlinFileSpecBuilder { | ||
return builder.addFileComment(KotlinCodeGeneration.format.FORMAT_STRING, "Hello World") | ||
} | ||
} | ||
|
||
AddDocProcessor().execute(TestContext(className("foo", "bar"), MutableSpiRegistry()), file) | ||
|
||
assertThat(file.spec().code).isEqualToIgnoringWhitespace(""" | ||
// "Hello World" | ||
package foo | ||
""".trimIndent()) | ||
} | ||
} |
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