Packages

t

hedgehog.munit

HedgehogAssertions

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
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HedgehogAssertions
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type Failure = core.Result.Failure

    See also

    hedgehog.core.Result.Failure

  2. type Success = core.Result.Success.type

    See also

    hedgehog.core.Result.Success

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def Failure(log: List[Log]): core.Result.Failure

    Alias for Result.Failure

    Alias for Result.Failure

    See also

    See hedgehog.core.Result.Failure

  5. lazy val Success: (HedgehogAssertions.this)#Success

    Alias for Result.Success

    Alias for Result.Success

    See also

    hedgehog.core.Result.Success

  6. def all(l: List[Result]): core.Result

    Alias for Result.all

    Alias for Result.all

    See also

    hedgehog.core.Result.all

  7. def any(l: List[Result]): core.Result

    Alias for Result.any

    Alias for Result.any

    See also

    hedgehog.core.Result.any

  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def assert(cond: => Boolean): Result

    Fails the test with a failure Result when cond is false.

    Fails the test with a failure Result when cond is false.

    returns

    Success iff cond is true. Failure otherwise.

  10. def assertEquals[A, B](obtained: A, expected: B)(implicit ev: <:<[B, A]): Result

    Fails the test if obtained and expected are non-equal using ==.

    Fails the test if obtained and expected are non-equal using ==.

    obtained

    The actual value

    expected

    The expected value

    returns

    Success iff obtained == expected. Failure otherwise.

  11. 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.

  12. 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.

  13. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  14. 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

  15. 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

  16. 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.

  17. 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

  18. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  20. def error(e: Exception): core.Result

    Alias for Result.error

    Alias for Result.error

    See also

    hedgehog.core.Result.error

  21. def fail(message: String): Result

    Fails a test with the given message

    Fails a test with the given message

    returns

    Failure, always.

  22. 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.

  23. def failure: core.Result

    Alias for Result.failure

    Alias for Result.failure

    See also

    hedgehog.core.Result.failure

  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  30. def success: core.Result

    Alias for Result.success

    Alias for Result.success

    See also

    hedgehog.core.Result.success

  31. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  32. def toString(): String
    Definition Classes
    AnyRef → Any
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. 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

  1. def assert(cond: => Boolean, clue: => Any): Result

    Fails the test with a failure Result when cond is false.

    Fails the test with a failure Result when cond is false.

    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

  2. def assertEquals[A, B](obtained: A, expected: B, clue: => Any)(implicit ev: <:<[B, A]): Result

    Fails the test if obtained and expected are non-equal using ==.

    Fails the test if obtained and expected 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped