trait HedgehogAssertions extends AnyRef
Mirrors munit.Assertions assertions, allowing munit users to use familiar assertions while returning proper hedgehog.Result objects in property tests.
Signatures don't line up exactly -- munit.Assertions is not F-bound polymorphic, so there is no way to align the signatures of the same argumentns with different return types in scala. We can, however, simply omit the implicit location arguments, because hedgehog.Result doesn't require munit.Location. Except in cases where Location is passed explicitly (which should be rare in user code), this should result in fairly easy adoption by munit and munit-scalacheck users.
- Self Type
- HedgehogAssertions with Assertions
- Alphabetic
- By Inheritance
- HedgehogAssertions
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type Failure = core.Result.Failure
- See also
hedgehog.core.Result.Failure
- type Success = core.Result.Success.type
- See also
hedgehog.core.Result.Success
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def Failure(log: List[Log]): core.Result.Failure
Alias for Result.Failure
Alias for Result.Failure
- See also
See hedgehog.core.Result.Failure
- lazy val Success: (HedgehogAssertions.this)#Success
Alias for Result.Success
Alias for Result.Success
- See also
hedgehog.core.Result.Success
- def all(l: List[Result]): core.Result
Alias for Result.all
Alias for Result.all
- See also
hedgehog.core.Result.all
- def any(l: List[Result]): core.Result
Alias for Result.any
Alias for Result.any
- See also
hedgehog.core.Result.any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def assert(cond: => Boolean): Result
Fails the test with a failure Result when
cond
isfalse
.Fails the test with a failure Result when
cond
isfalse
.- returns
Success iff cond is true. Failure otherwise.
- def assertEquals[A, B](obtained: A, expected: B)(implicit ev: <:<[B, A]): Result
Fails the test if
obtained
andexpected
are non-equal using==
.Fails the test if
obtained
andexpected
are non-equal using==
.- obtained
The actual value
- expected
The expected value
- returns
Success iff obtained == expected. Failure otherwise.
- def assertNoDiff(obtained: String, expected: String): Result
Asserts two strings are equal.
Asserts two strings are equal.
- obtained
The actual string
- expected
The expected value
- returns
Success iff actual is obtained. Failure otherwise.
- def assertNotEquals[A, B](obtained: A, expected: B)(implicit ev: =:=[A, B]): Result
Asserts two values are nonequal.
Asserts two values are nonequal.
- obtained
The actual value
- expected
The expected value
- ev
Ensures that obtained and expected are of the same type.
- returns
Success iff obtained != actua.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def diff[A, B](a: A, b: B)(f: (A, B) => Boolean): core.Result
Alias for Result.diff
Alias for Result.diff
- See also
hedgehog.core.Result.diff
- def diffDouble(obtained: Double, expected: Double, delta: Double = 0.00): Result
Asserts two doubles are equal +- some erorr value.
Asserts two doubles are equal +- some erorr value.
- obtained
The actual value.
- expected
The expected value.
- delta
The error allowed for double == comparison. Default is 0.00.
- returns
Success iff obtained approximately equals expected +- delta. Failure otherwis
- def diffFloat(obtained: Float, expected: Float, delta: Float = 0.0f): Result
Float specialized version of HedgehogAssertions.assertEquals.
Float specialized version of HedgehogAssertions.assertEquals.
Asserts two floats are equal within +- some error value.
- obtained
The actual value
- expected
The expected value
- delta
The error allowed for float == comparison. Default is 0.0f
- returns
Success iff obtained approximately equals expected +- delta. Failure otherwise.
- def diffNamed[A, B](logName: String, a: A, b: B)(f: (A, B) => Boolean): core.Result
Alias for Result.diffNamed
Alias for Result.diffNamed
- See also
hedgehog.core.Result.diffNamed
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def error(e: Exception): core.Result
Alias for Result.error
Alias for Result.error
- See also
hedgehog.core.Result.error
- def fail(message: String): Result
Fails a test with the given message
Fails a test with the given message
- returns
Failure, always.
- def fail(message: String, cause: Throwable): Result
Fails a test.
Fails a test.
Analagous to munit.Assertions.fail.
- message
The message to include in the failure.
- cause
An optional underlying exception to use as the cause of the failure.
- returns
Failure, always.
- def failure: core.Result
Alias for Result.failure
Alias for Result.failure
- See also
hedgehog.core.Result.failure
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def success: core.Result
Alias for Result.success
Alias for Result.success
- See also
hedgehog.core.Result.success
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withMunitAssertions(body: => (Assertions) => Any): Any
Turns off hedgehog munit-like assertions, so users can use both property- and non-property- based-tests in their test suites.
Turns off hedgehog munit-like assertions, so users can use both property- and non-property- based-tests in their test suites. By using the passed assertions parameter, all the standard munit assertions that do not return unit are available, despite name ambiguities.
Usage
test("1 + 1 is 2"){ withMunitAssertions{ assertions => assertEquals(1 + 1, 2) } }
- body
a test body, taking an assertions parameter
Deprecated Value Members
- def assert(cond: => Boolean, clue: => Any): Result
Fails the test with a failure Result when
cond
isfalse
.Fails the test with a failure Result when
cond
isfalse
.Analagous to munit.Assertions.assert.
Only the condition is used. Clues are ignored.
- clue
ignored -- usage triggers the deprecation warning
- returns
Success iff cond is true. Failure otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version ) Clues are unnecessary with hedgehog. Use HedgehogAssertions.diff, which will automatically output clues
- def assertEquals[A, B](obtained: A, expected: B, clue: => Any)(implicit ev: <:<[B, A]): Result
Fails the test if
obtained
andexpected
are non-equal using==
.Fails the test if
obtained
andexpected
are non-equal using==
.Analagous to munit.Assertions.assert.
Only the obtained and expected values are used.
- obtained
The actual value
- clue
Ignored -- Triggers deprecation warning
- ev
Evidence that A and B are of the same type for the comparison to be valid.
- returns
Success iff obtained == expected. Failure otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version ) Clues are unnecessary with hedgehog. Use HedgehogAssertions.assertEquals, which will automatically output clues
- def assertEqualsDouble(obtained: Double, expected: Double, delta: Double, clue: => Any): Result
Double specialized version of
HedgehogAssertions.assertEquals
.Double specialized version of
HedgehogAssertions.assertEquals
.Asserts two double values are equal +- some error value.
Analagous to munit.Assertions.assertEqualsDouble.
Only the obtained, expected and delta parameters are used.
- obtained
The actual value.
- expected
The expected value.
- delta
The error allowed for double == comparison.
- clue
Ignored -- usage triggers a deprecation warning
- returns
Success iff obtained approximately equals expected +- delta. Failure otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version ) Clues are unnecessary with hedgehog. Use HedgehogAssertions.diffDouble, which will automatically output clues
- def assertEqualsFloat(obtained: Float, expected: Float, delta: Float, clue: => Any): Result
Float specialized version of assertEquals.
Float specialized version of assertEquals.
Asserts two floats are equal within +- some error value.
Analagous to munit.Assertions.assertEqualsFloat.
- obtained
The actual value
- expected
The expected value
- delta
The error allowed for float == comparison.
- clue
Ignored -- usage triggers deprecation warning
- returns
Success iff obtained approximately equals expected +- delta. Failure otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version ) Clues are unnecessary with hedgehog. Use HedgehogAssertions.diffFloat, which will automatically output clues
- def assertNoDiff(obtained: String, expected: String, clue: => Any): Result
Asserts two strings are equal without outputting a diff.
Asserts two strings are equal without outputting a diff.
Analagous to munit.Assertions.assertNoDiff.
- obtained
The actual string
- expected
The expected string
- clue
Ignored -- usage triggers a deprecation warning
- returns
Success iff actual is obtained. Failure otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version ) Clues are unnecessary with hedgehog. Use HedgehogAssertions.diff, which will automatically output clues
- def assertNotEquals[A, B](obtained: A, expected: B, clue: => Any)(implicit ev: =:=[A, B]): Result
Asserts obtained is not equal to expected using ==.
Asserts obtained is not equal to expected using ==.
Analagous to munit.Assertions.notEquals.
- obtained
The actual value
- expected
The expected value
- clue
Ignored -- Usage triggers a deprecation warning
- ev
Evidence that obtained and expected are of the same type.
- returns
Success iff obtained != expected. Failure otherwise.
- Annotations
- @deprecated
- Deprecated
(Since version ) Clues are unnecessary with hedgehog. Use HedgehogAssertions.assertNotEquals, which will automatically output clues
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)