Added installation instructions.

This commit is contained in:
Joey 2015-07-07 13:46:08 -06:00
commit 24be4aeef9

View file

@ -1,33 +1,37 @@
# einheit
Nim unit testing library inspired by Python's unit tests. Nim's unittest library is good, but I wanted something a little more "Nim" feeling. I also really like Python's unittest module and thought it would be nice to have something similar in Nim. Also, unittest doesn't have much documentation on how to use it, and it's pretty bare bones, so I wanted a little more functionality and documentation.
Einheit means unit in German.
Einheit is a Nim unit testing library inspired by Python's unit tests. Nim's unittest library is good, but I wanted something a little more "Nim" feeling. I also really like Python's unittest module and thought it would be nice to have something similar in Nim. Also, unittest doesn't have much documentation on how to use it, and it's pretty bare bones, so I wanted a little more functionality and documentation.
The benefit of the macro style I chose means that you can document your tests nicely as well :)
### Description
Compile-time macro that allows a user to easily define tests and run them.
test_suite is a compile-time macro that allows a user to easily define tests and run them.
Methods are used for inheritance, so if you want to derive a test
suite, then you have to make sure the base suite uses methods
for the tests that you want to derive.
Methods are used for inheritance, so if you want to derive a test suite, then you have to make sure the base suite uses methods for the tests that you want to derive.
If you don't want inheritance, you can just use procs.
A special proc/method is called setup(). The macro will inject
this if it doesn't exist and it will be called before running
the test suite.
A special proc/method is called setup(). The macro will inject this method/proc if it doesn't exist and it will be called before running the test suite.
Test methods/procs to be run are prefixed with "test" in the
method/proc name. This is so that you can write tests that call
procs that do other things and won't be run as a test.
Test methods/procs to be run are prefixed with "test" in the method/proc name. This is so that you can write tests that call procs that do other things and won't be run as a test.
For each suite method/proc, an implicit variable called "self"
is added. This lets you access the test_suite in an OO kind
of way.
For each suite method/proc, an implicit variable called "self" is added. This lets you access the test_suite in an OO kind of way.
### Installation
Install with nimble!
```bash
nimble install einheit
```
### Usage
```nim
import einheit
test_suite SuiteName of TestSuite:
var