Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sksamuel committed Aug 11, 2024
1 parent d91ceeb commit fa191af
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ dependencies {
bundledPlugin("com.intellij.java")
bundledPlugin("org.jetbrains.kotlin")
bundledPlugin("org.jetbrains.plugins.gradle")
testFramework(TestFrameworkType.Platform)
testFramework(TestFrameworkType.Plugin.Java)
}

// we bundle this for 4.1 support
Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/io/kotest/plugin/intellij/CallbacksTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.kotest.plugin.intellij

import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.psi.CallbackType
Expand All @@ -9,10 +9,10 @@ import io.kotest.plugin.intellij.psi.specs
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import java.nio.file.Paths

class CallbacksTest : BasePlatformTestCase() {
class CallbacksTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get(".//").toAbsolutePath()
val path = Paths.get("./src/test/resources/").toAbsolutePath()
return path.toString()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.kotest.plugin.intellij.intentions

import com.intellij.openapi.command.CommandProcessor
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.jetbrains.kotlin.idea.core.moveCaret
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import java.nio.file.Paths

class AssertSoftlyIntentionTest : BasePlatformTestCase() {
class AssertSoftlyIntentionTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.kotest.plugin.intellij.intentions

import com.intellij.openapi.command.CommandProcessor
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.collections.shouldBeEmpty
import io.kotest.matchers.shouldBe
import org.jetbrains.kotlin.idea.core.moveCaret
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import java.nio.file.Paths

class BangIntentionTest : BasePlatformTestCase() {
class BangIntentionTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.kotest.plugin.intellij.intentions

import com.intellij.openapi.command.CommandProcessor
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import org.jetbrains.kotlin.idea.core.moveCaret
import org.jetbrains.kotlin.idea.util.application.runWriteAction
import java.nio.file.Paths

class ShouldThrowIntentionTest : BasePlatformTestCase() {
class ShouldThrowIntentionTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/io/kotest/plugin/intellij/psi/ClassTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import com.intellij.openapi.projectRoots.Sdk
import com.intellij.pom.java.LanguageLevel
import com.intellij.testFramework.IdeaTestUtil
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import java.nio.file.Paths

class ClassTests : BasePlatformTestCase() {
class ClassTests : LightJavaCodeInsightFixtureTestCase() {

private val descriptor = object : ProjectDescriptor(LanguageLevel.HIGHEST) {
override fun getSdk(): Sdk {
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/io/kotest/plugin/intellij/psi/FactoryTests.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.kotest.plugin.intellij.psi

import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.core.spec.style.funSpec
import io.kotest.matchers.shouldBe
import org.jetbrains.kotlin.psi.KtNamedFunction
import java.nio.file.Paths

fun foo(a: String) = funSpec { }

class FactoryTests : BasePlatformTestCase() {
class FactoryTests : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/io/kotest/plugin/intellij/psi/LeafTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.kotest.plugin.intellij.psi

import com.intellij.psi.PsiFileFactory
import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf
import org.jetbrains.kotlin.idea.KotlinFileType
Expand All @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.KtObjectDeclaration
import org.jetbrains.kotlin.psi.KtProperty

class LeafTest : BasePlatformTestCase() {
class LeafTest : LightJavaCodeInsightFixtureTestCase() {

fun testObjectShouldBeKtClassOrObject() {
val element = PsiFileFactory
Expand Down
9 changes: 6 additions & 3 deletions src/test/kotlin/io/kotest/plugin/intellij/psi/OffsetsTest.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package io.kotest.plugin.intellij.psi

import com.intellij.psi.PsiElement
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.psi.PsiWhiteSpace
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf
import org.jetbrains.kotlin.psi.psiUtil.endOffset
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import java.nio.file.Paths

class OffsetsTest : BasePlatformTestCase() {
class OffsetsTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
return path.toString()
Expand All @@ -26,7 +29,7 @@ class OffsetsTest : BasePlatformTestCase() {
val psiFile = myFixture.configureByFile("/funspec.kt")
val element: PsiElement? = psiFile.elementAtLine(24)
element.shouldNotBeNull()
// element.node.shouldBeInstanceOf<PsiWhiteSpace>()
element.node.shouldBeInstanceOf<PsiWhiteSpace>()
element.startOffset shouldBe 361
element.endOffset shouldBe 369
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/io/kotest/plugin/intellij/psi/SpecTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package io.kotest.plugin.intellij.psi

import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.nulls.shouldBeNull
import io.kotest.matchers.shouldBe
import java.nio.file.Paths

class SpecTests : BasePlatformTestCase() {
class SpecTests : LightJavaCodeInsightFixtureTestCase() {

override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class AnnotationSpecRunMarkerTest : BasePlatformTestCase() {
class AnnotationSpecRunMarkerTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.assertions.assertSoftly
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class BehaviorSpecRunMarkerTest : BasePlatformTestCase() {
class BehaviorSpecRunMarkerTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.assertions.assertSoftly
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
Expand All @@ -15,7 +15,7 @@ data class Gutter(
val icon: Icon = AllIcons.RunConfigurations.TestState.Run
)

class DescribeSpecRunMarkerTest : BasePlatformTestCase() {
class DescribeSpecRunMarkerTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class ExpectSpecStyleTest : BasePlatformTestCase() {
class ExpectSpecStyleTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class FeatureSpecStyleTest : BasePlatformTestCase() {
class FeatureSpecStyleTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class FreeSpecRunMarkerTest : BasePlatformTestCase() {
class FreeSpecRunMarkerTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.assertions.assertSoftly
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class FunSpecRunMarkerTest : BasePlatformTestCase() {
class FunSpecRunMarkerTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.assertions.assertSoftly
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class ShouldSpecStyleTest : BasePlatformTestCase() {
class ShouldSpecStyleTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.assertions.assertSoftly
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class StringSpecStyleTest : BasePlatformTestCase() {
class StringSpecStyleTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.kotest.plugin.intellij.styles

import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf
import io.kotest.plugin.intellij.Constants
Expand All @@ -19,7 +19,7 @@ import java.nio.file.Paths
import javax.swing.tree.DefaultMutableTreeNode

@Suppress("UNCHECKED_CAST")
class TreeModelTest : BasePlatformTestCase() {
class TreeModelTest : LightJavaCodeInsightFixtureTestCase() {

override fun getProjectDescriptor(): LightProjectDescriptor = JAVA_11

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package io.kotest.plugin.intellij.styles

import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.icons.AllIcons
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import io.kotest.assertions.assertSoftly
import io.kotest.matchers.shouldBe
import io.kotest.plugin.intellij.testMode
import java.nio.file.Paths

class WordSpecStyleTest : BasePlatformTestCase() {
class WordSpecStyleTest : LightJavaCodeInsightFixtureTestCase() {

override fun getTestDataPath(): String {
val path = Paths.get("./src/test/resources/").toAbsolutePath()
Expand Down

0 comments on commit fa191af

Please sign in to comment.