mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
(cherry picked from commit bcb3c215ddcccfad3311ed5163503175e54254a4) IJ-CR-166188 GitOrigin-RevId: 0a16d89676ee5f7d9f80688805bd4312d7f20ccd
40 lines
1.1 KiB
Kotlin
40 lines
1.1 KiB
Kotlin
@file:Suppress("TestFunctionName")
|
|
|
|
package com.intellij.mcpserver.toolsets
|
|
|
|
import com.intellij.mcpserver.McpToolsetTestBase
|
|
import com.intellij.mcpserver.toolsets.general.FormattingToolset
|
|
import com.intellij.openapi.application.EDT
|
|
import com.intellij.openapi.fileEditor.FileEditorManager
|
|
import io.kotest.common.runBlocking
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.withContext
|
|
import kotlinx.serialization.json.JsonPrimitive
|
|
import kotlinx.serialization.json.buildJsonObject
|
|
import org.junit.jupiter.api.Test
|
|
|
|
class FormattingToolsetTest : McpToolsetTestBase() {
|
|
@Test
|
|
fun reformat_current_file() = runBlocking {
|
|
withContext(Dispatchers.EDT) {
|
|
FileEditorManager.getInstance(project).openFile(mainJavaFile, true)
|
|
}
|
|
testMcpTool(
|
|
FormattingToolset::reformat_current_file.name,
|
|
buildJsonObject {},
|
|
"ok"
|
|
)
|
|
}
|
|
|
|
@Test
|
|
fun reformat_file() = runBlocking {
|
|
testMcpTool(
|
|
FormattingToolset::reformat_file.name,
|
|
buildJsonObject {
|
|
put("pathInProject", JsonPrimitive(mainJavaFile.name))
|
|
},
|
|
"ok"
|
|
)
|
|
}
|
|
}
|