-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Much cleaner output, and default kotlin indentation.
- Loading branch information
Showing
4 changed files
with
198 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,111 +16,113 @@ limitations under the License. | |
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
plugins { | ||
id("java") | ||
id("java-library") | ||
id("org.jetbrains.kotlin.jvm") version "1.6.20" | ||
id("signing") | ||
id("maven-publish") | ||
id("java") | ||
id("java-library") | ||
id("org.jetbrains.kotlin.jvm") version "1.6.20" | ||
id("signing") | ||
id("maven-publish") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlin {} | ||
|
||
dependencies { | ||
implementation(kotlin("stdlib-jdk8")) | ||
implementation(kotlin("stdlib-jdk8")) | ||
testImplementation("junit:junit:4.13.1") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenCentral() | ||
} | ||
|
||
val sourcesJar by tasks.creating(Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(sourceSets.main.get().allSource) | ||
archiveClassifier.set("sources") | ||
from(sourceSets.main.get().allSource) | ||
} | ||
|
||
val javadocJar by tasks.creating(Jar::class) { | ||
dependsOn.add(tasks["javadoc"]) | ||
archiveClassifier.set("javadoc") | ||
from(tasks["javadoc"]) | ||
dependsOn.add(tasks["javadoc"]) | ||
archiveClassifier.set("javadoc") | ||
from(tasks["javadoc"]) | ||
} | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
jvmTarget = "1.8" | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = "net.saff.checkmark" | ||
artifactId = "checkmark" | ||
version = "0.1.1" | ||
|
||
from(components["java"]) | ||
|
||
|
||
artifact(sourcesJar) | ||
artifact(javadocJar) | ||
|
||
pom { | ||
name.set("checkmark") | ||
description.set("Minimum viable kotlin assertion framework") | ||
url.set("https://github.com/dsaff/checkmark") | ||
|
||
licenses { | ||
license { | ||
name.set("Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("dsaff") | ||
name.set("David Saff") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("https://github.com/dsaff/checkmark.git") | ||
developerConnection.set("https://github.com/dsaff/checkmark.git") | ||
url.set("https://github.com/dsaff/checkmark") | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("maven") { | ||
groupId = "net.saff.checkmark" | ||
artifactId = "checkmark" | ||
version = "0.1.2" | ||
|
||
from(components["java"]) | ||
|
||
|
||
artifact(sourcesJar) | ||
artifact(javadocJar) | ||
|
||
pom { | ||
name.set("checkmark") | ||
description.set("Minimum viable kotlin assertion framework") | ||
url.set("https://github.com/dsaff/checkmark") | ||
|
||
licenses { | ||
license { | ||
name.set("Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
// For snapshots, url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2") | ||
credentials { | ||
// Hopefully these are grabbed from gradle.properties a la | ||
// https://community.sonatype.com/t/how-to-hide-the-nexus-username-and-password-when-publish-artifacts-to-nexus/4439/2 | ||
username = nexusUsername | ||
password = nexusPassword | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("dsaff") | ||
name.set("David Saff") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("https://github.com/dsaff/checkmark.git") | ||
developerConnection.set("https://github.com/dsaff/checkmark.git") | ||
url.set("https://github.com/dsaff/checkmark") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val nexusUsername: String by project | ||
val nexusPassword: String by project | ||
|
||
repositories { | ||
maven { | ||
// For snapshots, url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2") | ||
credentials { | ||
username = nexusUsername | ||
password = nexusPassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign(publishing.publications["maven"]) | ||
sign(publishing.publications["maven"]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package test.net.saff.checkmark | ||
|
||
import net.saff.checkmark.Checkmark.Companion.check | ||
import net.saff.checkmark.showWhitespace | ||
import net.saff.checkmark.thrown | ||
import org.junit.Test | ||
|
||
class CheckmarkTest { | ||
@Test | ||
fun checkIncludesCaptures() { | ||
val n = "Apple sauce" | ||
thrown { "Pear soup".check { it == n } }!!.message.check { it!!.contains("Apple") } | ||
} | ||
|
||
// SAFF: are failures printed twice on purpose? | ||
@Test | ||
fun outputWithMark() { | ||
// SAFF: no "this" if there's only this | ||
val expect = """ | ||
|Failed assertion: | ||
|- actual: A | ||
|- marked: B | ||
""".trimMargin().showWhitespace() | ||
thrown { "A".check { it == mark("B") } }!!.message!!.showWhitespace().check { | ||
it == expect | ||
} | ||
} | ||
} |