-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from gregorath/weaver-integration
Add integration for Weaver test framework
- Loading branch information
Showing
6 changed files
with
74 additions
and
9 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
17 changes: 17 additions & 0 deletions
17
modules/weaver/src/main/scala-2.13/difflicious/weaver/WeaverDiff.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,17 @@ | ||
package difflicious.weaver | ||
|
||
import difflicious.{Differ, DiffResultPrinter} | ||
import weaver.{Expectations, SourceLocation} | ||
import weaver.Expectations.Helpers.{failure, success} | ||
|
||
trait WeaverDiff { | ||
implicit class DifferExtensions[A](differ: Differ[A]) { | ||
def assertNoDiff(obtained: A, expected: A)(implicit pos: SourceLocation): Expectations = { | ||
val result = differ.diff(obtained, expected) | ||
if (!result.isOk) failure(DiffResultPrinter.consoleOutput(result, 0).render) | ||
else success | ||
} | ||
} | ||
} | ||
|
||
object WeaverDiff extends WeaverDiff |
16 changes: 16 additions & 0 deletions
16
modules/weaver/src/main/scala-3/difflicious.weaver/WeaverDiff.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,16 @@ | ||
package difflicious.weaver | ||
|
||
import difflicious.{Differ, DiffResultPrinter} | ||
import weaver.Expectations | ||
import weaver.Expectations.Helpers.{failure, success} | ||
|
||
trait WeaverDiff { | ||
extension [A](differ: Differ[A]) | ||
inline def assertNoDiff(obtained: A, expected: A): Expectations = { | ||
val result = differ.diff(obtained, expected) | ||
if (!result.isOk) failure(DiffResultPrinter.consoleOutput(result, 0).render) | ||
else success | ||
} | ||
} | ||
|
||
object WeaverDiff extends WeaverDiff |