Skip to content

Commit fe5b9a9

Browse files
committed
test: CliOptions test
1 parent e764c12 commit fe5b9a9

File tree

1 file changed

+39
-0
lines changed
  • compiler/suspend-transform-plugin/src/test/kotlin/love/forte/plugin/suspendtrans/test

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package love.forte.plugin.suspendtrans.test
2+
3+
import love.forte.plugin.suspendtrans.CliOptions
4+
import love.forte.plugin.suspendtrans.SuspendTransformConfiguration
5+
import kotlin.test.Test
6+
import kotlin.test.assertEquals
7+
8+
9+
/**
10+
*
11+
* @author ForteScarlet
12+
*/
13+
class CliOptionsTest {
14+
15+
@Test
16+
fun formatTest() {
17+
val annotations = listOf(
18+
SuspendTransformConfiguration.IncludeAnnotation("Hello", false),
19+
SuspendTransformConfiguration.IncludeAnnotation("World", true)
20+
)
21+
22+
val config = SuspendTransformConfiguration().apply {
23+
jvm {
24+
syntheticBlockingFunctionIncludeAnnotations = annotations
25+
}
26+
}
27+
28+
CliOptions.Jvm.SYNTHETIC_BLOCKING_FUNCTION_INCLUDE_ANNOTATIONS.also { opt ->
29+
val value = opt.resolveToValue(config)
30+
val newConfig = SuspendTransformConfiguration()
31+
opt.resolveFromValue(newConfig, value)
32+
assertEquals(annotations, newConfig.jvm.syntheticBlockingFunctionIncludeAnnotations)
33+
}
34+
35+
36+
}
37+
38+
39+
}

0 commit comments

Comments
 (0)