startest/expect

Assertions to be used in tests.

Functions

pub fn list_to_contain(actual: List(a), expected: a) -> Nil

Asserts that the given list contains the expected element.

pub fn list_to_not_contain(actual: List(a), expected: a) -> Nil

Asserts that the given list does not contain the expected element.

pub fn string_to_contain(actual: String, expected: String) -> Nil

Asserts that the given string contains the expected string.

pub fn string_to_end_with(
  actual: String,
  expected: String,
) -> Nil

Asserts that the given string ends with the expected string.

pub fn string_to_not_contain(
  actual: String,
  expected: String,
) -> Nil

Asserts that the given string does not contain the expected string.

pub fn string_to_start_with(
  actual: String,
  expected: String,
) -> Nil

Asserts that the given string starts with the expected string.

pub fn to_be_error(actual: Result(a, b)) -> b

Asserts that the given value is Error(_).

pub fn to_be_false(actual: Bool) -> Nil

Asserts that the given value is False.

pub fn to_be_none(actual: Option(a)) -> Nil

Asserts that the given value is None.

pub fn to_be_ok(actual: Result(a, b)) -> a

Asserts that the given value is Ok(_).

pub fn to_be_some(actual: Option(a)) -> a

Asserts that the given value is Some(_).

pub fn to_be_true(actual: Bool) -> Nil

Asserts that the given value is True.

pub fn to_equal(actual: a, expected expected: a) -> Nil

Asserts that the given value is equal to the expected value.

pub fn to_loosely_equal(
  actual: Float,
  expected expected: Float,
  tolerating tolerance: Float,
) -> Nil

Asserts that the given Float is equal to the expected Float within the provided tolerance.

pub fn to_not_equal(actual: a, expected expected: a) -> Nil

Asserts that the given value is not equal to the expected value.

pub fn to_not_throw(f: fn() -> a) -> a

Asserts that the given function does not throw an error.

pub fn to_throw(f: fn() -> a) -> Nil

Asserts that the given function throws an error.

Search Document