Skip to content

Commit

Permalink
Use newer junit.
Browse files Browse the repository at this point in the history
  • Loading branch information
laech committed Oct 6, 2023
1 parent 2acc4c4 commit a404fe4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
13 changes: 12 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ version = "0.2.3-SNAPSHOT"

repositories { mavenCentral() }

dependencies {
testImplementation("nz.lae.stacksrc:stacksrc-junit5:0.5.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.junit.vintage:junit-vintage-engine:5.10.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.0")
}

kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(11)) } }

intellij { version.set("2021.1") }
Expand All @@ -22,6 +29,10 @@ spotless {
}

tasks {
test { testLogging { exceptionFormat = TestExceptionFormat.FULL } }
test {
useJUnitPlatform()
systemProperty("junit.jupiter.extensions.autodetection.enabled", true)
testLogging { exceptionFormat = TestExceptionFormat.FULL }
}
patchPluginXml { untilBuild.set("") }
}
13 changes: 10 additions & 3 deletions src/test/java/com/gitlab/lae/intellij/jump/EditorsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ package com.gitlab.lae.intellij.jump

import com.intellij.openapi.fileTypes.FileTypes
import com.intellij.testFramework.fixtures.BasePlatformTestCase
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class EditorsTest : BasePlatformTestCase() {

fun `test search offsets returns offsets matching query`() {
@Test
fun `search offsets returns offsets matching query`() {
myFixture.configureByText(FileTypes.PLAIN_TEXT, "HelloWorld")
val editor = myFixture.editor
assertOrderedEquals(
Expand All @@ -14,7 +19,8 @@ class EditorsTest : BasePlatformTestCase() {
EditorOffset(editor, 6))
}

fun `test search offsets skip fold regions`() {
@Test
fun `search offsets skip fold regions`() {
myFixture.configureByText(
FileTypes.PLAIN_TEXT,
"""
Expand All @@ -40,7 +46,8 @@ class EditorsTest : BasePlatformTestCase() {
EditorOffset(editor, 28))
}

fun `test search offsets sorts by distance from caret`() {
@Test
fun `search offsets sorts by distance from caret`() {
val text = "ABAB A"
myFixture.configureByText(FileTypes.PLAIN_TEXT, text)
val editor = myFixture.editor
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/com/gitlab/lae/intellij/jump/TreeTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.gitlab.lae.intellij.jump

class TreeTest : junit.framework.TestCase() {
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

class TreeTest {

@Test
fun `test to tree`() {
val actual = treeOf(listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), 2)
val expected =
Expand Down

0 comments on commit a404fe4

Please sign in to comment.