summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorVarriount <Varriount@users.noreply.github.com>2015-01-05 23:01:56 -0500
committerVarriount <Varriount@users.noreply.github.com>2015-01-05 23:01:56 -0500
commit2a7b9c64a38984e888eeb42e04680c466b5d4d6e (patch)
tree951d33c78db52faca5128906494127795b90681b
parent7f6de4495ed1271ce8f618e8be863eebdef7e8e7 (diff)
parent6a8d38f35837d1b6b1a87bd2fa8f113e1a306866 (diff)
downloadNim-2a7b9c64a38984e888eeb42e04680c466b5d4d6e.tar.gz
Merge pull request #1883 from flaviut/add-unittest-docs
Add an example and remove future claims from unittest.nim
-rw-r--r--lib/pure/unittest.nim27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index 77b23b067..8e7c8efe6 100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nim's Runtime Library
-#        (c) Copyright 2012 Nim Contributors
+#        (c) Copyright 2015 Nim Contributors
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -9,12 +9,27 @@
 
 ## :Author: Zahary Karadjov
 ##
-## This module implements the standard unit testing facilities such as
-## suites, fixtures and test cases as well as facilities for combinatorial 
-## and randomzied test case generation (not yet available) 
-## and object mocking (not yet available)
+## This module implements boilerplate to make testing easy.
 ##
-## It is loosely based on C++'s boost.test and Haskell's QuickTest
+## Example:
+##
+## .. code:: nim
+##
+##   suite "description for this stuff":
+##     test "essential truths":
+##       # give up and stop if this fails
+##       require(true)
+##
+##     test "slightly less obvious stuff":
+##       # print a nasty message and move on, skipping
+##       # the remainder of this block
+##       check(1 != 1)
+##       check("asd"[2] == 'd')
+##
+##     test "out of bounds error is thrown on bad access":
+##       let v = @[1, 2, 3]  # you can do initialization here
+##       expect(IndexError):
+##         discard v[4]
 
 import
   macros