Skip to content

Commit

Permalink
Added StringSpec #32
Browse files Browse the repository at this point in the history
  • Loading branch information
sksamuel committed Jul 3, 2016
1 parent 9f46d7d commit 61d16b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/main/kotlin/io/kotlintest/specs/StringSpec.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.kotlintest.specs

import io.kotlintest.TestCase
import io.kotlintest.properties.PropertyTesting

abstract class StringSpec : PropertyTesting() {

operator fun String.invoke(test: () -> Unit): TestCase {
val tc = TestCase(root, this, test)
root.cases.add(tc)
return tc
}
}
2 changes: 0 additions & 2 deletions src/test/kotlin/io/kotlintest/specs/ShouldSpecTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.kotlintest.specs

import io.kotlintest.ListStack
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger

class ShouldSpecTest : ShouldSpec() {

Expand Down
16 changes: 16 additions & 0 deletions src/test/kotlin/io/kotlintest/specs/StringSpecTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.kotlintest.specs

class StringSpecTest : StringSpec() {

init {

"strings.size should return size of string" {
"hello".length shouldBe 5
"hello" should haveLength(5)
}

"strings should support config" {
"hello".length shouldBe 5
}.config(invocations = 5)
}
}

0 comments on commit 61d16b0

Please sign in to comment.