"Fossies" - the Fresh Open Source Software Archive

Member "scala-js-1.3.1/junit-runtime/src/main/scala/org/junit/internal/ArrayComparisonFailure.scala" (14 Nov 2020, 907 Bytes) of package /linux/www/scala-js-1.3.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Scala source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * Ported from https://github.com/junit-team/junit
    3  */
    4 package org.junit.internal
    5 
    6 object ArrayComparisonFailure
    7 
    8 class ArrayComparisonFailure(message: String, cause: AssertionError, index: Int)
    9     extends AssertionError(message, cause) {
   10 
   11   private var fIndices: List[Int] = index :: Nil
   12 
   13   @deprecated("This constructor is not used and will be removed", "0.6.21")
   14   def this(fMessage: String) =
   15     this(fMessage, new AssertionError, 0)
   16 
   17   def addDimension(index: Int): Unit = {
   18     fIndices = index :: fIndices
   19   }
   20 
   21   override def getMessage(): String = {
   22     val msg = if (message != null) message else ""
   23     val indices =
   24       if (fIndices == null) s"[$index]" // see #3148
   25       else fIndices.map(index => s"[$index]").mkString
   26     val causeMessage = getCause.getMessage
   27     s"${msg}arrays first differed at element $indices; $causeMessage"
   28   }
   29 
   30   override def toString(): String = getMessage
   31 }