Skip to content

Commit

Permalink
rename test; dump new api
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Jun 30, 2022
1 parent d4d2364 commit a86891d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ public abstract class net/mamoe/mirai/console/command/CompositeCommand : net/mam
public fun getUsage ()Ljava/lang/String;
}

protected abstract interface annotation class net/mamoe/mirai/console/command/CompositeCommand$ChildCommand : java/lang/annotation/Annotation {
}

protected abstract interface annotation class net/mamoe/mirai/console/command/CompositeCommand$Description : java/lang/annotation/Annotation {
public abstract fun value ()Ljava/lang/String;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import java.time.temporal.TemporalAccessor
import kotlin.reflect.KClass
import kotlin.test.*

class TestParentCompositeCommand : CompositeCommand(
class TestContainerCompositeCommand : CompositeCommand(
owner,
"testParentComposite", "tsPC"
"testContainerComposite", "tsPC"
) {

class ChildCompositeCommand1 : CompositeCommand(owner, "useless") {
Expand All @@ -56,18 +56,18 @@ class TestParentCompositeCommand : CompositeCommand(
}

@ChildCommand
val child1: ChildCompositeCommand1 = ChildCompositeCommand1();
val child1: ChildCompositeCommand1 = ChildCompositeCommand1()

@ChildCommand
val child2: ChildCompositeCommand2 = ChildCompositeCommand2();
val child2: ChildCompositeCommand2 = ChildCompositeCommand2()

@SubCommand
fun parentFoo(seconds: Int) {
fun containerFoo(seconds: Int) {
Testing.ok(seconds)
}

@SubCommand
fun parentBar(seconds: Int) {
fun containerBar(seconds: Int) {
Testing.ok(seconds)
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ internal class InstanceTestCommand : AbstractConsoleInstanceTest() {
private val simpleCommand by lazy { TestSimpleCommand() }
private val rawCommand by lazy { TestRawCommand() }
private val compositeCommand by lazy { TestCompositeCommand() }
private val parentCompositeCommand by lazy { TestParentCompositeCommand() }
private val containerCompositeCommand by lazy { TestContainerCompositeCommand() }

@BeforeEach
fun grantPermission() {
Expand Down Expand Up @@ -540,19 +540,19 @@ internal class InstanceTestCommand : AbstractConsoleInstanceTest() {
}

@Test
fun `parent composite command executing`() = runBlocking {
parentCompositeCommand.withRegistration {
fun `container composite command executing`() = runBlocking {
containerCompositeCommand.withRegistration {
assertEquals(1, withTesting {
assertSuccess(parentCompositeCommand.execute(sender, "parentFoo 1"))
assertSuccess(containerCompositeCommand.execute(sender, "containerFoo 1"))
})
assertEquals(1, withTesting {
assertSuccess(parentCompositeCommand.execute(sender, "parentBar 1"))
assertSuccess(containerCompositeCommand.execute(sender, "containerBar 1"))
})
assertEquals(2, withTesting {
assertSuccess(parentCompositeCommand.execute(sender, "foo 2"))
assertSuccess(containerCompositeCommand.execute(sender, "foo 2"))
})
assertEquals(2, withTesting {
assertSuccess(parentCompositeCommand.execute(sender, "bar 2"))
assertSuccess(containerCompositeCommand.execute(sender, "bar 2"))
})
}
}
Expand Down

0 comments on commit a86891d

Please sign in to comment.