std.test

A simple test library.

Types

type Test a = std.writer.Writer (std.list.List String) a

type TestCase a = 
    | std.test.Test String (() -> std.test.Test a)
    | Group String (Array (std.test.TestCase a))

Values

let functor : std.functor.Functor std.test.Test

A Functor represents an action on a parameterized type which does not change the structure with the mapped type.

The following laws should hold:

  • map id == id
  • map (f << g) == map f << map g

let applicative : std.applicative.Applicative std.test.Test

A Functor with application.

The following laws should hold:

  • wrap id <*> v = v
  • wrap (<<) <> u <> v <> w = u <> (v <*> w)
  • wrap f <*> wrap x = wrap (f x)
  • u <> wrap y = wrap (\g -> g x) <> u

let monad : std.monad.Monad std.test.Test

A generalised interface for imperatively sequencing actions

let test : forall a . String -> (() -> std.test.Test a) -> std.test.TestCase a

let group : forall a . String -> Array (std.test.TestCase a) -> std.test.TestCase a

let assert x : std.types.Bool -> ()

let assert_eq l r : forall a . [std.show.Show a] -> [std.cmp.Eq a] -> a -> a -> std.test.Test ()

let assert_neq l r : forall a . [std.show.Show a] -> [std.cmp.Eq a] -> a -> a -> std.test.Test ()

let run test : forall a . std.test.Test a -> ()