-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from xebia-functional/add-testing
Add testing
- Loading branch information
Showing
22 changed files
with
551 additions
and
35 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
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
30 changes: 30 additions & 0 deletions
30
compiler-plugin/src/test-gen/com/xebia/runners/BoxTestGenerated.java
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,30 @@ | ||
|
||
|
||
package com.xebia.runners; | ||
|
||
import com.intellij.testFramework.TestDataPath; | ||
import org.jetbrains.kotlin.test.util.KtTestUtil; | ||
import org.jetbrains.kotlin.test.TargetBackend; | ||
import org.jetbrains.kotlin.test.TestMetadata; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
import java.util.regex.Pattern; | ||
|
||
/** This class is generated by {@link com.xebia.GenerateKotlinCompilerTestKt}. DO NOT MODIFY MANUALLY */ | ||
@SuppressWarnings("all") | ||
@TestMetadata("src/testData/box") | ||
@TestDataPath("$PROJECT_ROOT") | ||
public class BoxTestGenerated extends AbstractBoxTest { | ||
@Test | ||
public void testAllFilesPresentInBox() throws Exception { | ||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("src/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); | ||
} | ||
|
||
@Test | ||
@TestMetadata("simple.kt") | ||
public void testSimple() throws Exception { | ||
runTest("src/testData/box/simple.kt"); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
compiler-plugin/src/test-gen/com/xebia/runners/DiagnosticTestGenerated.java
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,23 @@ | ||
|
||
|
||
package com.xebia.runners; | ||
|
||
import com.intellij.testFramework.TestDataPath; | ||
import org.jetbrains.kotlin.test.util.KtTestUtil; | ||
import org.jetbrains.kotlin.test.TestMetadata; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
import java.util.regex.Pattern; | ||
|
||
/** This class is generated by {@link com.xebia.GenerateKotlinCompilerTestKt}. DO NOT MODIFY MANUALLY */ | ||
@SuppressWarnings("all") | ||
@TestMetadata("src/testData/diagnostics") | ||
@TestDataPath("$PROJECT_ROOT") | ||
public class DiagnosticTestGenerated extends AbstractDiagnosticTest { | ||
@Test | ||
public void testAllFilesPresentInDiagnostics() throws Exception { | ||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("src/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
compiler-plugin/src/test/kotlin/com/xebia/generateKotlinCompilerTest.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,19 @@ | ||
package com.xebia | ||
|
||
import com.xebia.runners.AbstractBoxTest | ||
import com.xebia.runners.AbstractDiagnosticTest | ||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5 | ||
|
||
fun main() { | ||
generateTestGroupSuiteWithJUnit5 { | ||
testGroup(testDataRoot = "src/testData", testsRoot = "src/test-gen") { | ||
testClass<AbstractDiagnosticTest> { | ||
model("diagnostics") | ||
} | ||
|
||
testClass<AbstractBoxTest> { | ||
model("box") | ||
} | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
compiler-plugin/src/test/kotlin/com/xebia/runners/AbstractBoxTest.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,35 @@ | ||
package com.xebia.runners | ||
|
||
import org.jetbrains.kotlin.test.TargetBackend | ||
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor | ||
import org.jetbrains.kotlin.test.backend.handlers.IrTextDumpHandler | ||
import org.jetbrains.kotlin.test.backend.handlers.IrTreeVerifierHandler | ||
import org.jetbrains.kotlin.test.backend.handlers.JvmBoxRunner | ||
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade | ||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder | ||
import org.jetbrains.kotlin.test.builders.fir2IrStep | ||
import org.jetbrains.kotlin.test.builders.irHandlersStep | ||
import org.jetbrains.kotlin.test.builders.jvmArtifactsHandlersStep | ||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.DUMP_IR | ||
import org.jetbrains.kotlin.test.runners.RunnerWithTargetBackendForTestGeneratorMarker | ||
|
||
open class AbstractBoxTest : BaseTestRunner(), RunnerWithTargetBackendForTestGeneratorMarker { | ||
override val targetBackend: TargetBackend = TargetBackend.JVM_IR | ||
|
||
override fun TestConfigurationBuilder.configuration() { | ||
defaultDirectives { +DUMP_IR } | ||
|
||
commonFirWithPluginFrontendConfiguration() | ||
fir2IrStep() | ||
irHandlersStep { | ||
useHandlers( | ||
::IrTextDumpHandler, | ||
::IrTreeVerifierHandler, | ||
) | ||
} | ||
facadeStep(::JvmIrBackendFacade) | ||
jvmArtifactsHandlersStep { useHandlers(::JvmBoxRunner) } | ||
|
||
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor) | ||
} | ||
} |
Oops, something went wrong.