Skip to content

Commit 1d88072

Browse files
committed
Get SpecSpec and fixture.SpecSpec to pass under Scala 2.13.0-M5.
1 parent 0646883 commit 1d88072

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

scalatest/src/main/scala/org/scalatest/fixture/SpecLike.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ trait SpecLike extends org.scalatest.fixture.TestSuite with Informing with Notif
135135
case e: TestCanceledException => throw new NotAllowedException(FailureMessages.assertionShouldBePutInsideDefNotObject, Some(e), posOrElseStackDepthFun(e.position, (_: StackDepthException) => 8))
136136
case dtne: DuplicateTestNameException => throw dtne
137137
case other: Throwable if (!Suite.anExceptionThatShouldCauseAnAbort(other)) =>
138-
if (ScalaTestVersions.BuiltForScalaVersion == "2.12" || ScalaTestVersions.BuiltForScalaVersion == "2.13")
138+
if (ScalaTestVersions.BuiltForScalaVersion == "2.12")
139139
throw new NotAllowedException(FailureMessages.exceptionWasThrownInObject(Prettifier.default, UnquotedString(other.getClass.getName), UnquotedString(scopeDesc)), Some(other), Right((_: StackDepthException) => 9))
140+
else if (ScalaTestVersions.BuiltForScalaVersion startsWith "2.13")
141+
throw new NotAllowedException(FailureMessages.exceptionWasThrownInObject(Prettifier.default, UnquotedString(other.getClass.getName), UnquotedString(scopeDesc)), Some(other), Right((_: StackDepthException) => 7))
140142
else
141143
throw new NotAllowedException(FailureMessages.exceptionWasThrownInObject(Prettifier.default, UnquotedString(other.getClass.getName), UnquotedString(scopeDesc)), Some(other), Right((_: StackDepthException) => 8))
142144
case other: Throwable => throw other

scalatest/src/main/scala/org/scalatest/refspec/RefSpecLike.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ trait RefSpecLike extends TestSuite with Informing with Notifying with Alerting
124124
case e: TestFailedException => throw new NotAllowedException(FailureMessages.assertionShouldBePutInsideDefNotObject, Some(e), posOrElseStackDepthFun(e.position, _ => 8))
125125
case e: TestCanceledException => throw new NotAllowedException(FailureMessages.assertionShouldBePutInsideDefNotObject, Some(e), posOrElseStackDepthFun(e.position, _ => 8))
126126
case other: Throwable if (!Suite.anExceptionThatShouldCauseAnAbort(other)) =>
127-
if (ScalaTestVersions.BuiltForScalaVersion == "2.12" || ScalaTestVersions.BuiltForScalaVersion == "2.13")
127+
if (ScalaTestVersions.BuiltForScalaVersion == "2.12")
128128
throw new NotAllowedException(FailureMessages.exceptionWasThrownInObject(Prettifier.default, UnquotedString(other.getClass.getName), UnquotedString(scopeDesc)), Some(other), Right((_: StackDepthException) => 9))
129+
else if (ScalaTestVersions.BuiltForScalaVersion startsWith "2.13")
130+
throw new NotAllowedException(FailureMessages.exceptionWasThrownInObject(Prettifier.default, UnquotedString(other.getClass.getName), UnquotedString(scopeDesc)), Some(other), Right((_: StackDepthException) => 7))
129131
else
130132
throw new NotAllowedException(FailureMessages.exceptionWasThrownInObject(Prettifier.default, UnquotedString(other.getClass.getName), UnquotedString(scopeDesc)), Some(other), Right((_: StackDepthException) => 8))
131133
case other: Throwable => throw other

0 commit comments

Comments
 (0)