-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME
More file actions
79 lines (47 loc) · 1.7 KB
/
README
File metadata and controls
79 lines (47 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
~ lemon ~
lemon is a tiny, fast unit-testing framework designed to be small, really
small. That way you can worry less about setting up the framework and more
about writing tests.
~ download ~
Download the latest stable version from the lemon Git repository (hosted
on GitHub):
git clone git://github.com/etscrivner/lemon.git
~ compiling ~
Requires Ruby Make (rake), simply run:
rake all
This will build the examples as well as the unit-tests for lemon itself.
~ installation ~
Just add lemon.h to your project or place it in a common directory for your
compiler (On Linux/Mac/Unix this might be /usr/local/include).
~ a not-so-bitter taste of lemon ~
To start writing tests in lemon:
1) initialize lemon (number of planned tests is optional)
lemon::test<> lemon(num_tests_which_you_plan_to_run);
2) conduct tests
lemon.is(this_one_equal_to, that_one, descriptive_test_name);
3) display results
lemon.done();
~ assertions ~
lemon provides a minimal but complete set of assertions:
* ok(boolean_condition, descriptive_test_name)
* not_ok(boolean_condition, descriptive_test_name)
* is(this_one, that_one, descriptive_test_name)
* isnt(this_one, that_one, descriptive_test_name)
* pass(descriptive_test_name)
* fail(descriptive_test_name)
~ skipping ~
skipping tests is equally easy:
lemon::test<> lemon(...);
...
LEMON_SKIP(lemon, "These tests don't work at the moment") {
lemon.is(a, b, "a is b");
lemon.ok(foo(), "foo is true");
}
~ todo ~
writing tests before you write code? todo blocks can help:
lemon::test<> lemon(...);
...
LEMON_TODO(lemon) {
lemon.is(tumtum(), fizbaz(), "tumtum is fizbaz");
lemon.not_ok(cannibalism(), "cannibalism is not ok");
}