mirror of https://github.com/sbt/sbt.git
Make checkTypeTag lenient on "scala." type prefix
This commit is contained in:
parent
7e9e4879aa
commit
b1d02bee30
|
|
@ -11,6 +11,17 @@ class LogExchangeSpec extends FlatSpec with Matchers {
|
||||||
checkTypeTag("stringTypeTagTraceEvent", stringTypeTagTraceEvent, StringTypeTag[TraceEvent])
|
checkTypeTag("stringTypeTagTraceEvent", stringTypeTagTraceEvent, StringTypeTag[TraceEvent])
|
||||||
checkTypeTag("stringTypeTagSuccessEvent", stringTypeTagSuccessEvent, StringTypeTag[SuccessEvent])
|
checkTypeTag("stringTypeTagSuccessEvent", stringTypeTagSuccessEvent, StringTypeTag[SuccessEvent])
|
||||||
|
|
||||||
private def checkTypeTag[A, B](name: String, actual: A, expected: B): Unit =
|
private def checkTypeTag[A](name: String, inc: StringTypeTag[A], exp: StringTypeTag[A]): Unit =
|
||||||
s"LogExchange.$name" should s"match real StringTypeTag[$expected]" in assert(actual == expected)
|
s"LogExchange.$name" should s"match real StringTypeTag[$exp]" in {
|
||||||
|
val StringTypeTag(incomingString) = inc
|
||||||
|
val StringTypeTag(expectedString) = exp
|
||||||
|
if ((incomingString startsWith "scala.") || (expectedString startsWith "scala.")) {
|
||||||
|
// > historically [Scala] has been inconsistent whether `scala.` is included, or not
|
||||||
|
// > would it be hard to make the test accept either result?
|
||||||
|
// https://github.com/scala/community-builds/pull/758#issuecomment-409760633
|
||||||
|
assert((incomingString stripPrefix "scala.") == (expectedString stripPrefix "scala."))
|
||||||
|
} else {
|
||||||
|
assert(incomingString == expectedString)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue