de-mock-racy

2022-11-07

Simplistic mocking library.

Upstream URL

github.com/sirherrbatka/de-mock-racy

Author

Marek Kochanowicz

License

BSD simplified
README

0.1de-mock-racy: CL library for mocking

If you write unit tests, at all, you probably will need to also mock. This libary intends to make it reasonably easy. You just place (mocakble-block (label-of-block argument-1 argument2) (actual-implementation argument-1 argument-2)) in code and de-mock-racy provides you with the ability to replace (actual-implementation argument-1 argument-2) with something required for your unit test.

1How to use it?

Just read the example.lisp source code.

2Can I extend it?

You can. Check out generics.lisp file. WAITING-CALL-ACCEPT-P is for filter, WAITING-CALL-INVOKE for implementation. By default those simply call stored functions. You can often avoid subclassing by writing :filter and :implementation lambda forms manually, without FILTER and IMPLEMENTATION macros.

3Limitations

Well, in terms of performance this is not 0 overhead type of system. De-mock-racy pushes mockable-blocks over generic function dispatch. Selecting waiting-call is also performed in a linear fashion (scan array) which may prove insufficient -- in theory at least. I don't think it is a significant issue in practie.

Dependencies (1)

  • alexandria

Dependents (0)

    • GitHub
    • Quicklisp