-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additionally: * BUGFIX: incorrect rendering of durations * Rename forall to forEach * Build improvements
- Loading branch information
Showing
35 changed files
with
547 additions
and
273 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,7 @@ spaces { | |
} | ||
|
||
project.git = true | ||
|
||
project.excludeFilters = [ | ||
".*-scala-3.*" | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package weaver | ||
|
||
import cats.effect.IO | ||
import cats.effect.{ ContextShift, IO, Timer } | ||
|
||
trait BaseIOSuite extends RunnableSuite[IO] { | ||
implicit protected def effectCompat: UnsafeRun[IO] = CatsUnsafeRun | ||
final implicit protected def contextShift = effectCompat.contextShift | ||
final implicit protected def timer = effectCompat.timer | ||
final implicit protected def contextShift: ContextShift[IO] = | ||
effectCompat.contextShift | ||
final implicit protected def timer: Timer[IO] = effectCompat.timer | ||
} |
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 |
---|---|---|
|
@@ -55,5 +55,4 @@ private[weaver] trait CECompat { | |
} | ||
} | ||
} | ||
|
||
} |
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,13 @@ | ||
package weaver | ||
|
||
import com.eed3si9n.expecty._ | ||
|
||
class Expect | ||
extends Recorder[Boolean, Expectations] | ||
with UnaryRecorder[Boolean, Expectations] { | ||
|
||
def all(recordings: Boolean*): Expectations = | ||
macro VarargsRecorderMacro.apply[Boolean, Expectations] | ||
|
||
override lazy val listener = new ExpectyListener | ||
} |
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,5 @@ | ||
package weaver | ||
|
||
object ScalaCompat { | ||
def isScala3: Boolean = false | ||
} |
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,49 @@ | ||
package weaver | ||
|
||
// kudos to https://github.com/monix/minitest | ||
// format: off | ||
import scala.reflect.macros.whitebox | ||
|
||
trait SourceLocationMacro { | ||
|
||
import macros._ | ||
|
||
trait Here { | ||
/** | ||
* Pulls source location without being affected by implicit scope. | ||
*/ | ||
def here: SourceLocation = macro Macros.fromContext | ||
} | ||
|
||
implicit def fromContext: SourceLocation = | ||
macro Macros.fromContext | ||
|
||
|
||
} | ||
|
||
object macros { | ||
class Macros(val c: whitebox.Context) { | ||
import c.universe._ | ||
|
||
def fromContext: Tree = { | ||
val (pathExpr, relPathExpr, lineExpr) = getSourceLocation | ||
val SourceLocationSym = symbolOf[SourceLocation].companion | ||
q"""$SourceLocationSym($pathExpr, $relPathExpr, $lineExpr)""" | ||
} | ||
|
||
private def getSourceLocation = { | ||
val pwd = java.nio.file.Paths.get("").toAbsolutePath | ||
val p = c.enclosingPosition.source.path | ||
val abstractFile = c.enclosingPosition.source.file | ||
|
||
val rp = if (!abstractFile.isVirtual){ | ||
pwd.relativize(abstractFile.file.toPath()).toString() | ||
} else p | ||
|
||
val line = c.Expr[Int](Literal(Constant(c.enclosingPosition.line))) | ||
(p, rp, line) | ||
} | ||
|
||
} | ||
} | ||
// format: on |
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,18 @@ | ||
package weaver | ||
|
||
import cats.data.{ NonEmptyList, ValidatedNel } | ||
import cats.syntax.all._ | ||
|
||
import com.eed3si9n.expecty._ | ||
|
||
import scala.quoted._ | ||
|
||
class Expect | ||
extends Recorder[Boolean, Expectations] | ||
with UnaryRecorder[Boolean, Expectations] { | ||
|
||
inline def all(inline recordings: Boolean*): Expectations = | ||
${ RecorderMacro.varargs('recordings, 'listener) } | ||
|
||
override lazy val listener = new ExpectyListener | ||
} |
Oops, something went wrong.