From d515e0a923c0edc07414a741c60f5e463b67f934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 26 Apr 2012 00:13:31 +0200 Subject: [PATCH] Improve docs for assertions --- lib/ex_unit/assertions.ex | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/ex_unit/assertions.ex b/lib/ex_unit/assertions.ex index 5a8c0a920ac..a093e4e68ad 100644 --- a/lib/ex_unit/assertions.ex +++ b/lib/ex_unit/assertions.ex @@ -1,6 +1,25 @@ defexception ExUnit.AssertionError, message: "assertion failed" defmodule ExUnit.Assertions do + @moduledoc """ + This module contains a set of assertions functions that are + imported by default into your test cases. + + In general, a developer will want to use the general + `assert` macro in tests. The macro tries to be smart + and provide good reporting whenever there is a failure. + For example, `assert some_fun() == 10` will fail (assuming + `some_fun()` returns 13): + + Expected 10 to be equal to 13 + + This module also provides other small convenient functions + like `assert_match`, `assert_member` and `assert_raise` to + easily handle other common cases as, respectively, asserting + if two terms match, asserting if an item belongs to a list or + if a function raises an exception. + """ + @doc """ Asserts the `expected` value is true.