@@ -26,8 +26,7 @@ Can you count to funk?
2626 ~~~~ sh
2727 $ mkdir tests
2828 $ cp -r $CLAR_ROOT /clar* tests
29- $ cp $CLAR_ROOT /test/clar_test.h tests
30- $ cp $CLAR_ROOT /test/main.c.sample tests/main.c
29+ $ cp $CLAR_ROOT /example/* .c tests
3130 ~~~~
3231
3332- ** One: Write some tests**
@@ -147,7 +146,7 @@ To use Clar:
147146
1481471. copy the Clar boilerplate to your test directory
1491482. copy (and probably modify) the sample ` main.c` (from
150- ` $CLAR_PATH /test /main.c.sample ` )
149+ ` $CLAR_PATH /example /main.c` )
1511503. run the Clar mixer (a.k.a. ` generate.py` ) to scan your test directory and
152151 write out the test suite metadata.
1531524. compile your test files and the Clar boilerplate into a single test
@@ -159,7 +158,7 @@ The Clar boilerplate gives you a set of useful test assertions and features
159158the ` clar.c` and ` clar.h` files, plus the code in the ` clar/` subdirectory.
160159You should not need to edit these files.
161160
162- The sample ` main.c` (i.e. ` $CLAR_PATH /test /main.c.sample ` ) file invokes
161+ The sample ` main.c` (i.e. ` $CLAR_PATH /example /main.c` ) file invokes
163162` clar_test(argc, argv)` to run the tests. Usually, you will edit this file
164163to perform any framework specific initialization and teardown that you need.
165164
@@ -251,11 +250,16 @@ suite.
251250
252251- ` cl_fixture(const char * )` : Gets the full path to a fixture file.
253252
254- Please do note that these methods are * always* available whilst running a
255- test, even when calling auxiliary/static functions inside the same file.
253+ # ## Auxiliary / helper functions
256254
257- It' s strongly encouraged to perform test assertions in auxiliary methods,
258- instead of returning error values. This is considered good Clar style.
255+ The clar API is always available while running a test, even when calling
256+ " auxiliary" (helper) functions.
257+
258+ You' re encouraged to perform test assertions in those auxiliary
259+ methods, instead of returning error values. This is considered good
260+ Clar style. _However_, when you do this, you need to call `cl_invoke`
261+ to preserve the current state; this ensures that failures are reported
262+ as coming from the actual test, instead of the auxiliary method.
259263
260264Style Example:
261265
@@ -310,20 +314,19 @@ static void check_string(const char *str)
310314
311315void test_example__a_test_with_auxiliary_methods(void)
312316{
313- check_string("foo");
314- check_string("bar");
317+ cl_invoke( check_string("foo") );
318+ cl_invoke( check_string("bar") );
315319}
316320~~~~
317321
318322About Clar
319323==========
320324
321- Clar has been written from scratch by [Vicent Martí](https://github.com/vmg),
322- to replace the old testing framework in [libgit2][libgit2].
323-
324- Do you know what languages are *in* on the SF startup scene? Node.js *and*
325- Latin. Follow [@vmg](https://www.twitter.com/vmg) on Twitter to
326- receive more lessons on word etymology. You can be hip too.
327-
325+ Clar was originally written by [Vicent Martí](https://github.com/vmg),
326+ to replace the old testing framework in [libgit2][libgit2]. It is
327+ currently maintained by [Edward Thomson](https://github.com/ethomson),
328+ and used by the [libgit2][libgit2] and [git][git] projects, amongst
329+ others.
328330
329331[libgit2]: https://github.com/libgit2/libgit2
332+ [git]: https://github.com/git/git
0 commit comments