feat: Add a pipeline and some basic tests
continuous-integration/drone/push Build was killed Details

pull/1/head
kalle 2022-06-05 12:45:30 +02:00
parent cc86e69165
commit 8e0e16d1f4
2 changed files with 67 additions and 0 deletions

27
.drone.yml Normal file
View File

@ -0,0 +1,27 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: "Build"
image: "eclipse-temurin:16-jdk"
commands:
- "./gradlew assemble"
- name: "Test"
image: "eclipse-temurin:16-jdk"
commands:
- "./gradlew test"
- name: "Create Release"
image: plugins/gitea-release
settings:
api_key:
from_secret: "gitea_api_key"
base_url:
from_secret: "gitea_base_url"
files: build/libs/CSharpCommentChecker-*.jar
when:
branch:
- master

View File

@ -0,0 +1,40 @@
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
internal class MainKtTest {
@Test
fun `groupCommentLines groups two adjacent lines`() {
val lines = listOf(1, 2)
assertEquals(listOf(listOf(1, 2)), groupCommentLines(lines))
}
@Test
fun `groupCommentLines doesn't group two non adjacent lines`() {
val lines = listOf(1, 3)
assertEquals(listOf(listOf(1), listOf(3)), groupCommentLines(lines))
}
@Test
fun `groupCommentLines groups larger groups`() {
val lines = listOf(1, 2, 3, 4, 5)
assertEquals(listOf(listOf(1, 2, 3, 4, 5)), groupCommentLines(lines))
}
@Test
fun `groupCommentLines groups multiple groups`() {
val lines = listOf(1, 2, 3, 5, 6, 7)
assertEquals(listOf(listOf(1, 2, 3), listOf(5, 6, 7)), groupCommentLines(lines))
}
@Test
fun `groupCommentLines without any comments`() {
val lines = emptyList<Int>()
assertEquals(emptyList<List<Int>>(), groupCommentLines(lines))
}
}