-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
234 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
munit/shared/src/main/scala/munit/ComparisonFailExceptionHandler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package munit | ||
|
||
trait ComparisonFailExceptionHandler { | ||
def handle( | ||
message: String, | ||
obtained: String, | ||
expected: String, | ||
location: Location | ||
): Nothing | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package munit | ||
|
||
import munit.diff.Diff | ||
|
||
object DiffsAssetion { | ||
|
||
def assertNoDiff( | ||
obtained: String, | ||
expected: String, | ||
handler: ComparisonFailExceptionHandler, | ||
title: String, | ||
printObtainedAsStripMargin: Boolean | ||
)(implicit loc: Location): Boolean = { | ||
if (obtained.isEmpty && !expected.isEmpty) { | ||
val msg = | ||
s"""|Obtained empty output! | ||
|=> Expected: | ||
|$expected""".stripMargin | ||
handler.handle(msg, obtained, expected, loc) | ||
} | ||
val diff = new Diff(obtained, expected) | ||
if (diff.isEmpty) true | ||
else { | ||
handler.handle( | ||
diff.createReport(title, printObtainedAsStripMargin), | ||
obtained, | ||
expected, | ||
loc | ||
) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
munit/shared/src/main/scala/munit/internal/difflib/ComparisonFailExceptionHandler.scala
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.