Skip to content

Commit

Permalink
Added a workaround for failed test locating
Browse files Browse the repository at this point in the history
  • Loading branch information
rlegendi committed Jun 29, 2012
1 parent e65fb9f commit 9d312a4
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
Expand Up @@ -290,7 +290,19 @@ class ScalaTestNotifier(val spec: SpecificationStructure, val args: Arguments,
location = actScopeElement.location))
}

private def testFailed(name: String, message: String, location: String, f: Throwable, details: Option[Details], duration: Long): Unit = {
private def testFailed(name: String, message: String, simpleLocation: String, f: Throwable, details: Option[Details], duration: Long): Unit = {

// ------------------------------------------------------------------------
// This is a pending issue here. The original loc(location) method cannot
// be used here, since the location we get for this callback method is not
// similar to the other ones. Needs to consult with Eric.
//
// This is a temporal wrapper solution to fix the issue.

val location = spec.getClass.getName + " (" + simpleLocation + ")"

// ------------------------------------------------------------------------

if (debug) {
println(">>> testFailed: " + name + ", " + message + ", " + location + ", " + f + ", " + details + ", " + duration)
}
Expand Down
32 changes: 32 additions & 0 deletions src/test/scala/org/scalatest/bridges/ScalaTestBridgeTest.scala
@@ -0,0 +1,32 @@
package org.scalatest.bridges

import org.specs2.mutable._
import org.scalatest.WrapWith
import org.scalatest.specs2.Spec2Runner
import org.scalatest.ScalaTestBridge
import org.scalatest.events.IndentedText

@WrapWith(classOf[Spec2Runner])
class ScalaTestBridgeTest extends Specification {
"The getIndentedText()" should {
"work properly if picture is disabled" in {
"not indent text at level 0" in {
ScalaTestBridge.getIndentedText("a", 0, false) must have be_== (IndentedText("a", "a", 0))
}

"indent text at level 1" in {
ScalaTestBridge.getIndentedText("a", 1, false) must have be_== (IndentedText(" a", "a", 1))
}
}

"work properly if picture is enabled" in {
"not indent text at level 0" in {
ScalaTestBridge.getIndentedText("a", 0, true) must have be_== (IndentedText("a", "a", 0))
}

"indent text at level 1" in {
ScalaTestBridge.getIndentedText("a", 1, true) must have be_== (IndentedText(" a", "a", 1))
}
}
}
}
19 changes: 19 additions & 0 deletions src/test/scala/org/scalatest/bridges/Specs2BridgeTest.scala
@@ -0,0 +1,19 @@
package org.scalatest.bridges

import org.specs2.mutable._
import org.scalatest.WrapWith
import org.scalatest.specs2.Spec2Runner
import org.scalatest.events.IndentedText
import org.specs2.Specs2Bridge

@WrapWith(classOf[Spec2Runner])
class Specs2BridgeTest extends Specification {
// "The ()" should {
// "" in {
// Specs2Bridge. must have be_==(IndentedText("a", "a", 0))
// }
// "not awaken Musta-Krakish at a Deathklok concert" in {
// success
// }
// }
}

0 comments on commit 9d312a4

Please sign in to comment.