-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
97 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
unit-picker/src/main/kotlin/cc/unitmesh/pick/worker/LangWorker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package cc.unitmesh.pick.worker | ||
|
||
import cc.unitmesh.pick.output.Instruction | ||
import cc.unitmesh.pick.picker.PickJob | ||
|
||
abstract class LangWorker { | ||
abstract fun addJob(job: PickJob) | ||
abstract suspend fun start() | ||
abstract suspend fun start() : List<Instruction> | ||
} |
24 changes: 24 additions & 0 deletions
24
unit-picker/src/test/kotlin/cc/unitmesh/pick/output/InstructionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cc.unitmesh.pick.output; | ||
|
||
|
||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
import org.junit.jupiter.api.Test | ||
|
||
class InstructionTest { | ||
@Test | ||
fun shouldConvertInstructionToJson() { | ||
val instruction = InlineCodeCompletion( | ||
"Inline Code Completion", | ||
"Input for inline code completion", | ||
"java", | ||
"import java.util.*;\n" + | ||
"\n" + | ||
"public class Main {\n" + | ||
" public static void main(String[] args) {\n" | ||
) | ||
|
||
val output = Json.encodeToString(instruction) | ||
println(output) | ||
} | ||
} |