Skip to content

Commit

Permalink
Fixed issue with failing test in gradle #8
Browse files Browse the repository at this point in the history
  • Loading branch information
sksamuel committed Apr 16, 2016
1 parent 3283bc1 commit cc66136
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/io/kotlintest/KTestJUnitRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class KTestJUnitRunner(testClass: Class<TestBase>) : Runner() {
}

private fun descriptionForTest(suite: TestSuite, testcase: TestCase): Description? {
return map.getOrPut(testcase, { Description.createTestDescription(suite.name, testcase.name, counter.andIncrement) })
return map.getOrPut(testcase, { Description.createTestDescription(suite.name.replace(".", " "), testcase.name, counter.andIncrement) })
}

override fun run(notifier: RunNotifier?) {
Expand All @@ -44,10 +44,10 @@ class KTestJUnitRunner(testClass: Class<TestBase>) : Runner() {
notifier!!.fireTestStarted(desc)
try {
testcase.test()
notifier.fireTestFinished(desc)
} catch(e: TestFailedException) {
} catch(e: Exception) {
notifier.fireTestFailure(Failure(desc, e))
}
notifier.fireTestFinished(desc)
}
instance.afterAll()
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/kotlintest/TestFailedException.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package io.kotlintest

class TestFailedException(reason: String) : RuntimeException(reason)
class TestFailedException(message: String) : RuntimeException(message)
2 changes: 1 addition & 1 deletion src/main/kotlin/io/kotlintest/specs/WordSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ abstract class WordSpec : TestBase() {
infix operator fun String.invoke(test: () -> Unit): Unit = with(test)

infix fun String.with(test: () -> Unit): Unit {
current.cases.add(TestCase(this, test))
current.cases.add(TestCase("should " + this, test))
}
}
4 changes: 2 additions & 2 deletions src/test/kotlin/io/kotlintest/CollectionMatchersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CollectionMatchersTest : WordSpec() {
init {

"CollectionMatchers.contain" should {
"should test that a collection contains an element" with {
"test that a collection contains an element" with {
val col = listOf(1, 2, 3)

col should contain element 2
Expand All @@ -21,7 +21,7 @@ class CollectionMatchersTest : WordSpec() {
}

"CollectionMatchers.empty" should {
"should test that a collection contains an element" with {
"test that a collection contains an element" with {
val col = listOf(1, 2, 3)

expecting(TestFailedException::class) {
Expand Down
1 change: 1 addition & 0 deletions src/test/kotlin/io/kotlintest/WordSpecTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class WordSpecTest : WordSpec() {
stack.size() shouldBe 2
stack.pop() shouldBe "world"
stack.size() shouldBe 1
//false shouldBe true
}
}
"ListStack.peek" should {
Expand Down

0 comments on commit cc66136

Please sign in to comment.