Add inlining comment, newline.
[cl-mock.git] / README.md
1 -*- mode: markdown; coding: utf-8-unix; -*-
2
3 CL-MOCK - Mocking (generic) functions.
4
5 Copyright (C) 2013 Olof-Joachim Frahm
6
7 Release under a Simplified BSD license.
8
9 Working, but unfinished.
10
11 Should be portable thanks to [`CLOSER-MOP`][1].
12
13 Since it is pretty easy to just roll something like this on your own,
14 the main purpose is to develop a nice syntax (lispy, declarative) to
15 keep tests readable and maintainable.
16
17 Some parts may be used independently of the testing facilities,
18 e.g. dynamic `FLET` and method bindings with `PROGM` may be of general
19 interest.
20
21
22 # UTILITIES
23
24 `DFLET` dynamically rebinds functions similar to `FLET`:
25
26     > (defun foo () 42)
27     > (defun bar () (foo))
28     > (bar)
29     > => 42
30     > (dflet ((foo () 23))
31     >   (bar))
32     > => 23
33     > (OR) => 42, if FOO was inlined
34
35 The caveat is that this might not work on certain optimization settings,
36 including inlining.
37
38 The underlying function `PROGF` may be used as well similarly to standard
39 `PROG`:
40
41     > (progf '(foo) (list (lambda () 23))
42     >   (bar))
43     > => 23
44     > (OR) => 42, if FOO was inlined
45
46
47 [1]: http://common-lisp.net/project/closer/closer-mop.html