Commit c8816e67 authored by Him188's avatar Him188

Add test

parent 370844cb
package japttest;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.GlobalScope;
import net.mamoe.mirai.Bot;
import net.mamoe.mirai.BotAccount;
import net.mamoe.mirai.network.protocol.tim.packet.login.LoginResult;
import net.mamoe.mirai.network.protocol.tim.packet.login.SubmitPasswordPacket;
import test.JaptTestKt;
@SuppressWarnings("unused")
public class SuspendTest {
public static void main(String[] args) throws InterruptedException {
// TODO: 2019/12/6 Kotlin or IDE bug here
boolean bool = JaptTestKt.getLoginResult() == LoginResult.YOU_CAN_WRITE_ANY_THING;
BuildersKt.runBlocking(GlobalScope.INSTANCE.getCoroutineContext(), (scope, continuation) -> {
Bot bot = new Bot(new BotAccount(1994701021L, ""), scope.getCoroutineContext());
if (bot.network.login(continuation) instanceof SubmitPasswordPacket.LoginResponse.Success) {
System.out.println("login successful");
}
return null;
});
System.out.println("Hello world finished");
}
}
package test
import net.mamoe.mirai.network.protocol.tim.packet.login.LoginResult
@Suppress("RedundantSuspendModifier")
suspend fun suspendPrintln(arg: String) = println(arg)
suspend fun main() {
suspendPrintln("Hello")
suspendPrintln(" World!")
}
fun getLoginResult(): LoginResult = LoginResult.SUCCESS
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment