-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package strikt.assertions | ||
|
||
import strikt.api.Assertion | ||
|
||
fun Assertion<Boolean>.isTrue() = | ||
passesIf("is true") { this } | ||
|
||
fun Assertion<Boolean>.isFalse() = | ||
passesIf("is false") { !this } |
33 changes: 33 additions & 0 deletions
33
strikt-core/src/test/kotlin/strikt/assertions/BooleanAssertions.kt
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,33 @@ | ||
package strikt.assertions | ||
|
||
import org.jetbrains.spek.api.Spek | ||
import org.jetbrains.spek.api.dsl.describe | ||
import org.jetbrains.spek.api.dsl.it | ||
import strikt.api.expect | ||
import strikt.fails | ||
|
||
@Suppress("SimplifyBooleanWithConstants") | ||
internal object BooleanAssertions : Spek({ | ||
describe("assertions on ${Boolean::class.simpleName}") { | ||
describe("isTrue assertion") { | ||
it("passes when the subject is true") { | ||
expect("a" == "a").isTrue() | ||
} | ||
it("fails when the subject is false") { | ||
fails { | ||
expect("a" == "A").isTrue() | ||
} | ||
} | ||
} | ||
describe("isFalse assertion") { | ||
it("passes when the subject is false") { | ||
expect("a" == "A").isFalse() | ||
} | ||
it("fails when the subject is false") { | ||
fails { | ||
expect("a" == "a").isFalse() | ||
} | ||
} | ||
} | ||
} | ||
}) |