mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
fix settings.gradle.kts bundle smoke test was no longer included
add a check if directory exists in custom include (we had this in tutteli-gradle plugin, had definitely some merit)
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
description = "Represents a JDK >= 9 smoke test for atrium-infix-en_GB with jdk8 extension"
|
||||
|
||||
sourceCompatibility = JavaVersion.current()
|
||||
targetCompatibility = JavaVersion.current()
|
||||
|
||||
dependencies {
|
||||
//I don't see how to set up compileTestKotlin with --patch-module, so we have put the module-info.java directly in src/test/kotlin instead
|
||||
testImplementation prefixedProject('infix-en_GB-jvm')
|
||||
testImplementation prefixedProject('api-infix-en_GB-jdk8-jvm')
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package custom
|
||||
|
||||
import ch.tutteli.atrium.api.infix.en_GB.jdk8.notTo
|
||||
import ch.tutteli.atrium.api.infix.en_GB.exist
|
||||
import ch.tutteli.atrium.api.infix.en_GB.toBe
|
||||
import ch.tutteli.atrium.api.verbs.assert
|
||||
import ch.tutteli.atrium.assertions.Assertion
|
||||
import ch.tutteli.atrium.creating.Expect
|
||||
import ch.tutteli.atrium.domain.builders.ExpectImpl
|
||||
import ch.tutteli.atrium.reporting.RawString
|
||||
import ch.tutteli.atrium.reporting.translating.StringBasedTranslatable
|
||||
import ch.tutteli.atrium.translations.DescriptionBasic
|
||||
import org.spekframework.spek2.Spek
|
||||
import org.spekframework.spek2.style.specification.describe
|
||||
import java.nio.file.Paths
|
||||
|
||||
object SmokeSpec : Spek({
|
||||
test("see if `toBe` can be used") {
|
||||
assert(1) toBe 1
|
||||
}
|
||||
|
||||
test("see if `Path.existsNot` can be used") {
|
||||
assert(Paths.get("nonExisting")) notTo exist
|
||||
}
|
||||
|
||||
test("see if own assertion function without i18n can be used") {
|
||||
assert(2) tobe even
|
||||
}
|
||||
|
||||
test("see if own assertion function with i18n can be used") {
|
||||
assert(4) isMultipleOf 2
|
||||
}
|
||||
})
|
||||
|
||||
@Suppress("ClassName")
|
||||
object even
|
||||
|
||||
infix fun Expect<Int>.tobe(@Suppress("UNUSED_PARAMETER") even: even) =
|
||||
createAndAddAssertion(DescriptionBasic.IS, RawString.create("an even number")) { it % 2 == 0 }
|
||||
|
||||
infix fun Expect<Int>.isMultipleOf(base: Int): Expect<Int> = addAssertion(_isMultipleOf(this, base))
|
||||
|
||||
fun _isMultipleOf(expect: Expect<Int>, base: Int): Assertion =
|
||||
ExpectImpl.builder.createDescriptive(expect, DescriptionIntAssertions.IS_MULTIPLE_OF, base) {
|
||||
it % base == 0
|
||||
}
|
||||
|
||||
enum class DescriptionIntAssertions(override val value: String) : StringBasedTranslatable {
|
||||
IS_MULTIPLE_OF("is multiple of")
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
module ch.tutteli.atrium.infix.en_GB.jdk8.smoke {
|
||||
// test dependencies are usually defined in build.gradle via --patch-module but that's quite cumbersome and I did
|
||||
// not get it running in 10 minutes so I am using this, the effect should be the same, the kotlin compiler checks if
|
||||
// I am using symbols from packages I do not require etc.
|
||||
|
||||
requires ch.tutteli.atrium.infix.en_GB;
|
||||
requires ch.tutteli.atrium.api.infix.en_GB.jdk8;
|
||||
requires kotlin.stdlib;
|
||||
requires spek.dsl.jvm;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ fun Settings_gradle.includeBundleAndApisWithExtensionsAndSmokeTest(vararg apiNam
|
||||
includeKotlinJvmJs("bundles/$apiName", "atrium-$apiName")
|
||||
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
|
||||
include("bundles/$apiName/", "atrium-$apiName-smoke-test")
|
||||
includeKotlinJvmJs("bundles/$apiName/extensions/kotlin_1_3", "atrium-$apiName-smoke-test-kotlin_1_3")
|
||||
include("bundles/$apiName/extensions", "atrium-$apiName-smoke-test-kotlin_1_3")
|
||||
}
|
||||
includeKotlinJvmJsWithExtensions("apis/$apiName", "atrium-api-$apiName")
|
||||
}
|
||||
@@ -98,6 +98,10 @@ fun Settings_gradle.includeKotlinJvmJsWithExtensions(subPath: String, module: St
|
||||
}
|
||||
|
||||
fun Settings_gradle.include(subPath: String, projectName: String) {
|
||||
val dir = file("${rootProject.projectDir}/$subPath/$projectName")
|
||||
if(!dir.exists()){
|
||||
throw GradleException("cannot include project $projectName as its projectDir $dir does not exist")
|
||||
}
|
||||
include(projectName)
|
||||
project(":$projectName").projectDir = file("${rootProject.projectDir}/$subPath/$projectName")
|
||||
project(":$projectName").projectDir = dir
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user