Remove Spek add Kotest
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
org.openrndr.extra.convention.`kotlin-multiplatform`
|
||||
alias(libs.plugins.kotest.multiplatform)
|
||||
}
|
||||
|
||||
val embedShaders = tasks.register<EmbedShadersTask>("embedShaders") {
|
||||
@@ -9,16 +10,8 @@ val embedShaders = tasks.register<EmbedShadersTask>("embedShaders") {
|
||||
}.get()
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
testRuns["test"].executionTask {
|
||||
useJUnitPlatform {
|
||||
includeEngines("spek2")
|
||||
}
|
||||
}
|
||||
}
|
||||
kotlin.sourceSets.getByName("commonMain").kotlin.srcDir(embedShaders.outputDir)
|
||||
sourceSets {
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
implementation(libs.openrndr.application)
|
||||
@@ -31,10 +24,9 @@ kotlin {
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
runtimeOnly(libs.slf4j.simple)
|
||||
implementation(libs.kluent)
|
||||
implementation(libs.spek.dsl)
|
||||
runtimeOnly(libs.spek.junit5)
|
||||
runtimeOnly(libs.kotlin.reflect)
|
||||
implementation(libs.kotest.assertions)
|
||||
implementation(libs.kotest.framework.engine)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import org.amshove.kluent.`should be equal to`
|
||||
import org.amshove.kluent.internal.assertFails
|
||||
import io.kotest.assertions.shouldFail
|
||||
import io.kotest.assertions.throwables.shouldThrow
|
||||
import io.kotest.assertions.throwables.shouldThrowAny
|
||||
import io.kotest.assertions.throwables.shouldThrowUnit
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhraseRegistry.getGLSLFunctionName
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
|
||||
object TestFunctionNameRx : Spek({
|
||||
class TestFunctionNameRx : DescribeSpec({
|
||||
describe("A function name") {
|
||||
|
||||
mapOf(
|
||||
"ivec4 aaa() {" to "aaa",
|
||||
"ivec3 bbb() {" to "bbb",
|
||||
@@ -31,8 +32,8 @@ object TestFunctionNameRx : Spek({
|
||||
""".trimMargin() to "white"
|
||||
).forEach { (goodGLSL, expectedFuncName) ->
|
||||
it("can be extracted from valid GLSL") {
|
||||
getGLSLFunctionName(goodGLSL) `should be equal to`
|
||||
expectedFuncName
|
||||
getGLSLFunctionName(goodGLSL).shouldBeEqual(
|
||||
expectedFuncName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +44,7 @@ object TestFunctionNameRx : Spek({
|
||||
"float rnd {",
|
||||
).forEach { badGLSL ->
|
||||
it("is not extracted if GLSL function not declared") {
|
||||
assertFails {
|
||||
shouldThrowUnit<Throwable> {
|
||||
val funcName = getGLSLFunctionName(badGLSL)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import org.amshove.kluent.`should be`
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhrase
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhraseRegistry
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
|
||||
object TestShaderPhrase : Spek({
|
||||
class TestShaderPhrase : DescribeSpec({
|
||||
describe("A shader phrase") {
|
||||
val phrase = ShaderPhrase(
|
||||
"""
|
||||
@@ -16,7 +15,7 @@ object TestShaderPhrase : Spek({
|
||||
phrase.register()
|
||||
}
|
||||
it("can be found") {
|
||||
ShaderPhraseRegistry.findPhrase("test_phrase") `should be` phrase
|
||||
ShaderPhraseRegistry.findPhrase("test_phrase")?.shouldBeEqual(phrase)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import org.amshove.kluent.`should be`
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.kotest.matchers.equals.shouldBeEqual
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhrase
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhraseBook
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhraseRegistry
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
|
||||
class TestShaderPhraseBook : Spek({
|
||||
class TestShaderPhraseBook : DescribeSpec({
|
||||
describe("A shader phrase book") {
|
||||
val book = object : ShaderPhraseBook("testBook") {
|
||||
val phrase = ShaderPhrase(
|
||||
@@ -21,7 +20,7 @@ class TestShaderPhraseBook : Spek({
|
||||
it("can be found") {
|
||||
ShaderPhraseRegistry.findPhrase(
|
||||
"testBook.test_phrase"
|
||||
) `should be` book.phrase
|
||||
)!!.shouldBeEqual(book.phrase)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,12 +1,11 @@
|
||||
import org.amshove.kluent.`should contain`
|
||||
import org.amshove.kluent.`should not contain`
|
||||
import io.kotest.core.spec.style.DescribeSpec
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import io.kotest.matchers.string.shouldNotContain
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhrase
|
||||
import org.openrndr.extra.shaderphrases.ShaderPhraseBook
|
||||
import org.openrndr.extra.shaderphrases.preprocessShader
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
|
||||
class TestShaderPhrasePreprocessing : Spek({
|
||||
class TestShaderPhrasePreprocessing : DescribeSpec({
|
||||
describe("the glsl code") {
|
||||
val book = object : ShaderPhraseBook("testBook") {
|
||||
val phrase1 = ShaderPhrase("vec3 phrase1() { }")
|
||||
@@ -24,19 +23,19 @@ class TestShaderPhrasePreprocessing : Spek({
|
||||
val glslProcessed = preprocessShader(glsl)
|
||||
|
||||
it("should not contain phrase1 before preprocessing") {
|
||||
glsl `should not contain` book.phrase1.phrase
|
||||
glsl.shouldNotContain(book.phrase1.phrase)
|
||||
}
|
||||
|
||||
it("should not contain phrase2 before preprocessing") {
|
||||
glsl `should not contain` book.phrase2.phrase
|
||||
glsl.shouldNotContain(book.phrase2.phrase)
|
||||
}
|
||||
|
||||
it("should contain phrase1 after preprocessing") {
|
||||
glslProcessed `should contain` book.phrase1.phrase
|
||||
glslProcessed.shouldContain(book.phrase1.phrase)
|
||||
}
|
||||
|
||||
it("should contain phrase2 after preprocessing") {
|
||||
glslProcessed `should contain` book.phrase2.phrase
|
||||
glslProcessed.shouldContain(book.phrase2.phrase)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user