Add Ktnip KSP Tests
Workflow
1. Test Data
- •Create Kotlin source in
ktnip/src/jvmTest/resources/test-data/ - •Name:
FeatureName.kt(e.g. NewHandler.kt) - •Must import from telegram-bot (project dependency)
- •Include valid handlers with annotations being tested
2. Add to ProcessorK1Test
- •In ProcessorK1Test.kt
- •Add
@Test fun featureName() = runTest("test-data/FeatureName.kt")
3. Add to ProcessorK2Test
- •In ProcessorK2Test.kt
- •Add
@Test fun featureName() = runTest("test-data/FeatureName.kt", useK2 = true)
4. Custom Assertions (optional)
- •Use
compile(vararg SourceFile, ...)instead ofrunTestfor custom checks - •Returns
JvmCompilationResult; inspectexitCode,kspSourcesDir, generated files - •Pass custom
symbolProcessorsorprocessorProviders
runTest Behavior
- •Loads source from resources
- •Compiles with ActivityProcessorProvider (default)
- •Asserts
exitCode == OK - •Verifies generated files exist (ActivitiesData.kt, BotCtx.kt for K1)
- •K2 tests skip file checks (marked "improve")