Skip to content

Commit

Permalink
refactor: extract for typed test ins
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 23, 2023
1 parent 280ee34 commit edb892a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cc.unitmesh.core.unittest

import cc.unitmesh.core.Instruction
import cc.unitmesh.core.completion.CompletionBuilderType
import cc.unitmesh.core.completion.TypedIns

interface TypedTestIns {
val type: TestCodeBuilderType

fun unique(): Instruction
abstract class TypedTestIns : TypedIns {
override val type: CompletionBuilderType = CompletionBuilderType.FULL_FILE_COMPLETION
abstract val testType: TestCodeBuilderType
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ApiTestCodeBuilder(private val context: JobContext) : TestCodeBuilder {
}
}

class ApiTestIns(override val type: TestCodeBuilderType) : TypedTestIns {
class ApiTestIns(override val testType: TestCodeBuilderType) : TypedTestIns() {
override fun unique(): Instruction {
TODO("Not yet implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClassTestCodeBuilder(private val context: JobContext) : TestCodeBuilder {

}

class ClassTestIns(override val type: TestCodeBuilderType) : TypedTestIns {
class ClassTestIns(override val testType: TestCodeBuilderType) : TypedTestIns() {
override fun unique(): Instruction {
TODO("Not yet implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MethodTestCodeBuilder(private val context: JobContext) : TestCodeBuilder {

}

class MethodTestIns(override val type: TestCodeBuilderType) : TypedTestIns {
class MethodTestIns(override val testType: TestCodeBuilderType) : TypedTestIns() {
override fun unique(): Instruction {
TODO("Not yet implemented")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cc.unitmesh.pick.builder.unittest.lang

import cc.unitmesh.core.completion.TypedIns
import cc.unitmesh.core.unittest.TypedTestIns
import cc.unitmesh.pick.worker.job.InstructionFileJob
import cc.unitmesh.pick.worker.job.JobContext
import chapi.domain.core.CodeDataStruct
Expand Down Expand Up @@ -49,6 +51,10 @@ class JavaTestCodeService(val context: JobContext) : UnitTestService {
return outboundType + inboundsType
}

override fun build(): TypedTestIns {
TODO("Not yet implemented")
}

fun filterDs(
imports: List<CodeImport>,
returnType: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cc.unitmesh.pick.builder.unittest.lang

import cc.unitmesh.core.completion.TypedIns
import cc.unitmesh.pick.SupportedLang
import cc.unitmesh.pick.worker.job.JobContext
import chapi.domain.core.CodeDataStruct
Expand Down Expand Up @@ -54,6 +55,8 @@ interface UnitTestService {
*/
fun lookupRelevantClass(codeFunction: CodeFunction, dataStruct: CodeDataStruct): List<CodeDataStruct>

fun build(): TypedIns

companion object {
fun lookup(codeDataStruct: CodeDataStruct, job: JobContext): List<JavaTestCodeService> {
val testCodeServices = SupportedLang.all().map {
Expand Down

0 comments on commit edb892a

Please sign in to comment.