Assert
eff Assert
SourceAn effect used to perform assertions during program execution.
Operations
def assert(cond: Bool, msg: RichString): Unit \ Assert
SourceAsserts that the given condition cond
is true
with a message msg
.
Definitions
Asserts that the given foldable ma
is empty.
Asserts that the given values expected
and actual
are equal.
def assertEqWithMsg(expected: { expected = a }, actual: a, msg: String): Unit \ Assert with Eq[a]
SourceAsserts that the given values expected
and actual
are equal with the given message msg
.
def assertErr(r: Result[e, a]): Unit \ Assert
SourceAsserts that the given Result r
is Err(e)
.
def assertFalse(cond: Bool): Unit \ Assert
SourceAsserts that the given condition cond
is false
.
def assertFalseWithMsg(cond: Bool, msg: String): Unit \ Assert
SourceAsserts that the given condition cond
is false
with the given message msg
.
def assertMemberOf(x: a, ma: m[a]): Unit \ Assert + Aef[m] with Foldable[m], Eq[a], ToString[a], ToString[m[a]]
SourceAsserts that the given element x
is a member of the given foldable ma
.
def assertNeq(unexpected: { unexpected = a }, actual: a): Unit \ Assert with Eq[a], ToString[a]
SourceAsserts that the given values unexpected
and actual
are not equal.
def assertNeqWithMsg(unexpected: { unexpected = a }, actual: a, msg: String): Unit \ Assert with Eq[a]
SourceAsserts that the given values unexpected
and actual
are not equal with the given message msg
.
Asserts that the given foldable ma
is non-empty.
def assertNone(o: Option[a]): Unit \ Assert
SourceAsserts that the given Option o
is None
.
def assertOk(r: Result[e, a]): Unit \ Assert
SourceAsserts that the given Result r
is Ok(v)
.
def assertSome(o: Option[a]): Unit \ Assert
SourceAsserts that the given Option o
is Some(v)
.
def assertTrue(cond: Bool): Unit \ Assert
SourceAsserts that the given condition cond
is true
.
def assertTrueWithMsg(cond: Bool, msg: String): Unit \ Assert
SourceAsserts that the given condition cond
is true
with the given message msg
.
def fail(msg: String): Unit \ Assert
SourceUnconditionally fails with the given message msg
.
def handle(f: a -> b \ ef): a -> b \ (ef - Assert) + IO
SourceHandles the Assert
effect of the given function f
by throwing exceptions on assertion failures.
In other words, re-interprets the Assert
effect using the IO
effect.
def handleWithLogger(f: a -> b \ ef): a -> b \ (ef - Assert) + Logger
SourceHandles the Assert
effect by logging assertion failures using the Logger
effect.
Assertions continue execution after logging the assertion failure.
def handleWithNoOp(f: a -> b \ ef): a -> b \ ef - Assert
SourceHandles the Assert
effect by ignoring all assertions (no-op).
def handleWithPrompt(f: a -> b \ ef): a -> b \ (ef - Assert) + IO + Sys
SourceHandles the Assert
effect by prompting the user whether to continue execution.
When an assertion fails, prints the assertion failure and asks the user if they want to continue. If the user chooses not to continue, the program throws an exception.
def handleWithStdErr(f: a -> b \ ef): a -> b \ (ef - Assert) + IO + Sys
SourceHandles the Assert
effect by printing assertion failures to stderr.
Assertions continue execution after printing the assertion failure.
def handleWithStdOut(f: a -> b \ ef): a -> b \ (ef - Assert) + IO + Sys
SourceHandles the Assert
effect by printing assertion failures to stdout.
Assertions continue execution after printing the assertion failure.
def runWithIO(f: Unit -> a \ ef): a \ (ef - Assert) + IO
SourceRuns the Assert
effect of the given function f
by throwing exceptions on assertion failures.
In other words, re-interprets the Assert
effect using the IO
effect.
def success(msg: String): Unit \ Assert
SourceUnconditionally succeeds with the given message msg
.