dkandalov / datsok

Minimal test assertions for Kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

This is a minimal library with assertions for writing tests in Kotlin. It has no dependencies except Kotlin stdlib and has only three functions shouldEqual, shouldNotEqual and shouldThrow.

Examples

123 shouldEqual 123
123 shouldNotEqual 42

"foo" shouldEqual "foo"
"foo" shouldNotEqual "bar"

arrayOf(1, 2, 3) shouldEqual arrayOf(1, 2, 3)
(1 + 2 shouldEqual 3) * 5 shouldEqual 15

shouldThrow<Exception> { throw IllegalStateException() }
shouldThrow(SomeException("a message")) { throw SomeException("a message") }

Adding Gradle dependency

The library is only published on GitHub, so you'll need the following to add dependency in Gradle:

repositories {
    mavenCentral()
    ivy {
        artifactPattern("https://raw.githubusercontent.com/dkandalov/[module]/master/jars/[artifact]-[revision](.[ext])")
    }
}
dependencies {
    // ...
    testImplementation("datsok:datsok:0.6")
}

About

Minimal test assertions for Kotlin


Languages

Language:Kotlin 99.7%Language:Makefile 0.3%