Browse files

Added a workaround for failed test locating

  • Loading branch information...
1 parent e65fb9f commit 9d312a469874a59402827a17e3380e759c06c062 @rlegendi committed Jun 29, 2012
View
14 src/main/scala/org/scalatest/specs2/notifiers/ScalaTestNotifier.scala
@@ -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)
}
View
32 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))
+ }
+ }
+ }
+}
View
19 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.